This repository has been archived on 2024-10-06. You can view files and clone it, but cannot push or open issues or pull requests.
neovim/lua/plugins/telescope.lua
2024-09-23 11:45:46 +02:00

62 lines
1.9 KiB
Lua

local telescope = require('telescope')
local actions = require('telescope.actions')
local builtin = require('telescope.builtin')
local telescope_last = 0
function telescope_resume()
if telescope_last == 0 then
telescope_last = 1
builtin.live_grep()
else
builtin.resume()
end
end
telescope.setup {
defaults = {
sorting_strategy = "ascending",
live_grep_arguments = { 'rg',
'--hidden', '--no-ignore', '--color=never',
'--with-filename', '--line-number',
'--column', '--smart-case', '--no-heading',
},
preview = {
treesitter = false
},
},
pickers = {
live_grep = {
mappings = {
i = { ["<c-f>"] = actions.to_fuzzy_refine },
n = { ["<c-f>"] = telescope_resume },
},
},
find_files = {
cache_picker = false,
},
git_files = {
cache_picker = false,
},
},
}
-- Snippets can be useful.
vim.keymap.set('n', '<leader>ss', telescope.extensions.luasnip.luasnip, {})
-- Fuzzy * files, symbols, buffers, help, etc.
vim.keymap.set('n', '<leader>fa', builtin.find_files) -- f[ind]a[ll]
vim.keymap.set('n', '<leader>fb', builtin.buffers)
vim.keymap.set('n', '<leader>fd', builtin.diagnostics)
vim.keymap.set('n', '<leader>ff', builtin.git_files)
vim.keymap.set('n', '<leader>fh', builtin.help_tags)
vim.keymap.set('n', '<leader>fs', builtin.lsp_dynamic_workspace_symbols)
-- Grep (the only one).
vim.keymap.set('n', '<leader>gg', builtin.live_grep)
-- LSP navigation.
vim.keymap.set('n', '<leader>gd', builtin.lsp_definitions)
vim.keymap.set('n', '<leader>gr', builtin.lsp_references)
vim.keymap.set('n', '<leader>gi', builtin.lsp_implementations)
vim.keymap.set('n', '<leader>ci', builtin.lsp_incoming_calls)
vim.keymap.set('n', '<leader>co', builtin.lsp_outgoing_calls)