nvim/lua/plugins/telescope.lua

100 lines
3.6 KiB
Lua
Raw Normal View History

2023-02-19 23:01:47 +01:00
return {
2023-03-27 14:42:59 +02:00
{
-- Fuzzy Finder (files, lsp, etc)
2023-02-19 23:01:47 +01:00
'nvim-telescope/telescope.nvim',
version = '*',
dependencies = {
'nvim-lua/plenary.nvim',
{
'nvim-telescope/telescope-fzf-native.nvim',
-- NOTE: If you are having trouble with this installation,
-- refer to the README for telescope-fzf-native for more instructions.
build = 'make',
cond = function()
return vim.fn.executable 'make' == 1
end,
},
},
config = function()
-- [[ Configure Telescope ]]
-- See `:help telescope` and `:help telescope.setup()`
require('telescope').setup {
defaults = {
mappings = {
i = {
['<C-u>'] = false,
['<C-d>'] = false,
},
},
},
pickers = {
find_files = {
2023-05-16 11:20:05 +02:00
find_command = {
'rg',
'-S',
'--no-ignore-vcs',
'--hidden',
'--files',
'-g',
'!.git',
},
},
live_grep = {
grep_command = {
'rg',
'--no-ignore-vcs',
'--hidden',
'--color=never',
'--no-heading',
'--with-filename',
'--line-number',
'--column',
'--smart-case',
'-g',
'!.git',
},
2023-03-27 14:42:59 +02:00
},
2023-02-19 23:01:47 +01:00
},
}
-- Enable telescope fzf native, if installed
pcall(require('telescope').load_extension, 'fzf')
2023-04-05 22:31:54 +02:00
-- Enable harpoon
require('telescope').load_extension 'harpoon'
2023-02-19 23:01:47 +01:00
-- See `:help telescope.builtin`
vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' })
vim.keymap.set('n', '<leader><space>', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' })
vim.keymap.set('n', '<leader>/', function()
-- You can pass additional configuration to telescope to change theme, layout, etc.
require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
winblend = 10,
previewer = false,
})
end, { desc = '[/] Fuzzily search in current buffer' })
vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' })
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
vim.keymap.set('n', '<leader>ss', require('telescope.builtin').spell_suggest, { desc = '[S]pell [S]suggest' })
vim.keymap.set('n', '<leader>sc', function()
2023-03-27 14:42:59 +02:00
require('telescope.builtin').colorscheme { enable_preview = true }
2023-02-19 23:01:47 +01:00
end, { desc = '[S]earch [C]olorscheme' })
-- extensions
2023-04-05 22:31:54 +02:00
vim.api.nvim_set_keymap('n', '<leader>tc', ':TodoTelescope<CR>', { desc = '[T]odo [c]omments', noremap = true })
2023-05-18 11:51:48 +02:00
vim.api.nvim_set_keymap('n', '<leader>hm', ':Telescope harpoon marks<CR>', { desc = '[H]arpoon [m]arks', noremap = true })
2023-03-27 14:42:59 +02:00
end,
2023-02-19 23:01:47 +01:00
},
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
-- Only load if `make` is available. Make sure you have the system
-- requirements installed.
}