2023-12-18 14:27:58 +01:00
|
|
|
local telescope = require('telescope')
|
2024-01-03 00:15:20 +01:00
|
|
|
local actions = require('telescope.actions')
|
2023-08-03 02:49:25 +02:00
|
|
|
local builtin = require('telescope.builtin')
|
|
|
|
|
2024-09-17 16:46:38 +02:00
|
|
|
local telescope_last = 0
|
|
|
|
function telescope_resume()
|
|
|
|
if telescope_last == 0 then
|
|
|
|
telescope_last = 1
|
|
|
|
builtin.live_grep()
|
|
|
|
else
|
|
|
|
builtin.resume()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-12-18 14:27:58 +01:00
|
|
|
telescope.setup {
|
|
|
|
defaults = {
|
2024-02-25 22:45:46 +01:00
|
|
|
sorting_strategy = "ascending",
|
2024-01-03 00:15:20 +01:00
|
|
|
live_grep_arguments = { 'rg',
|
|
|
|
'--hidden', '--no-ignore', '--color=never',
|
2023-12-18 14:27:58 +01:00
|
|
|
'--with-filename', '--line-number',
|
2024-01-03 00:15:20 +01:00
|
|
|
'--column', '--smart-case', '--no-heading',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
pickers = {
|
|
|
|
live_grep = {
|
|
|
|
mappings = {
|
|
|
|
i = { ["<c-f>"] = actions.to_fuzzy_refine },
|
2024-09-17 16:46:38 +02:00
|
|
|
n = { ["<c-f>"] = telescope_resume },
|
2024-01-03 00:15:20 +01:00
|
|
|
},
|
2023-12-18 14:27:58 +01:00
|
|
|
},
|
2024-09-17 16:46:38 +02:00
|
|
|
find_files = {
|
|
|
|
cache_picker = false,
|
|
|
|
},
|
|
|
|
git_files = {
|
|
|
|
cache_picker = false,
|
|
|
|
},
|
2023-12-18 14:27:58 +01:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2024-09-17 16:46:38 +02:00
|
|
|
-- Snippets can be useful.
|
2024-06-10 13:12:26 +02:00
|
|
|
vim.keymap.set('n', '<leader>ss', telescope.extensions.luasnip.luasnip, {})
|
|
|
|
|
2024-09-17 16:46:38 +02:00
|
|
|
-- 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)
|
2024-06-10 13:12:26 +02:00
|
|
|
|
2024-09-17 16:46:38 +02:00
|
|
|
-- 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)
|