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',
|
2023-12-23 02:37:23 +01:00
|
|
|
branch = '0.1.x',
|
2023-02-19 23:01:47 +01:00
|
|
|
dependencies = {
|
|
|
|
'nvim-lua/plenary.nvim',
|
|
|
|
{
|
|
|
|
'nvim-telescope/telescope-fzf-native.nvim',
|
|
|
|
build = 'make',
|
|
|
|
cond = function()
|
|
|
|
return vim.fn.executable 'make' == 1
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
config = function()
|
2023-12-23 02:37:23 +01:00
|
|
|
local telescopeConfig = require 'telescope.config'
|
|
|
|
|
|
|
|
-- Clone the default Telescope configuration
|
|
|
|
local vimgrep_arguments = { unpack(telescopeConfig.values.vimgrep_arguments) }
|
|
|
|
|
|
|
|
-- I want to search in hidden/dot files.
|
|
|
|
table.insert(vimgrep_arguments, '--hidden')
|
|
|
|
-- I don't want to respect .gitignore but do want to respect .ignore
|
|
|
|
table.insert(vimgrep_arguments, '--no-ignore-vcs')
|
|
|
|
-- I don't want to search in the `.git` directory.
|
|
|
|
table.insert(vimgrep_arguments, '--glob')
|
|
|
|
table.insert(vimgrep_arguments, '!**/.git/*')
|
|
|
|
|
|
|
|
local rg_defaults = { 'rg', '-S', '--hidden', '--no-ignore-vcs', '--glob', '!**/.git/*' }
|
|
|
|
|
|
|
|
local find_command = { unpack(rg_defaults) }
|
|
|
|
table.insert(find_command, '--files')
|
|
|
|
|
|
|
|
local grep_command = { unpack(rg_defaults) }
|
|
|
|
table.insert(grep_command, '--color=never')
|
|
|
|
table.insert(grep_command, '--no-heading')
|
|
|
|
table.insert(grep_command, '--with-filename')
|
|
|
|
table.insert(grep_command, '--line-number')
|
|
|
|
table.insert(grep_command, '--column')
|
|
|
|
|
2023-02-19 23:01:47 +01:00
|
|
|
-- [[ Configure Telescope ]]
|
|
|
|
-- See `:help telescope` and `:help telescope.setup()`
|
|
|
|
require('telescope').setup {
|
|
|
|
defaults = {
|
2023-12-23 02:37:23 +01:00
|
|
|
vimgrep_arguments = vimgrep_arguments,
|
2023-02-19 23:01:47 +01:00
|
|
|
},
|
|
|
|
pickers = {
|
|
|
|
find_files = {
|
2023-12-23 02:37:23 +01:00
|
|
|
find_command = find_command,
|
2023-05-16 11:20:05 +02:00
|
|
|
},
|
|
|
|
live_grep = {
|
2023-12-23 02:37:23 +01:00
|
|
|
grep_command = grep_command,
|
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')
|
|
|
|
|
|
|
|
-- 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>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' })
|
2023-12-27 11:52:56 +01:00
|
|
|
vim.keymap.set('n', '<leader>sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' })
|
2023-03-27 14:42:59 +02:00
|
|
|
end,
|
2023-02-19 23:01:47 +01:00
|
|
|
},
|
|
|
|
}
|