redo telescope one more time :)

This commit is contained in:
Vladan Popovic 2024-09-17 16:46:38 +02:00
parent a1a4dc927e
commit 7d6b3e53c4

View file

@ -2,6 +2,16 @@ local telescope = require('telescope')
local actions = require('telescope.actions') local actions = require('telescope.actions')
local builtin = require('telescope.builtin') 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 { telescope.setup {
defaults = { defaults = {
sorting_strategy = "ascending", sorting_strategy = "ascending",
@ -15,25 +25,35 @@ telescope.setup {
live_grep = { live_grep = {
mappings = { mappings = {
i = { ["<c-f>"] = actions.to_fuzzy_refine }, 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, {}) vim.keymap.set('n', '<leader>ss', telescope.extensions.luasnip.luasnip, {})
vim.keymap.set('n', '<leader>ff', builtin.find_files, {}) -- Fuzzy * files, symbols, buffers, help, etc.
vim.keymap.set('n', '<leader>fg', builtin.git_files, {}) vim.keymap.set('n', '<leader>fa', builtin.find_files) -- f[ind]a[ll]
vim.keymap.set('n', '<leader>gg', builtin.live_grep, {}) vim.keymap.set('n', '<leader>fb', builtin.buffers)
vim.keymap.set('n', '<leader>fb', builtin.buffers, {}) vim.keymap.set('n', '<leader>fd', builtin.diagnostics)
vim.keymap.set('n', '<leader>fs', builtin.lsp_dynamic_workspace_symbols, {}) vim.keymap.set('n', '<leader>ff', builtin.git_files)
vim.keymap.set('n', '<leader>fsd', builtin.lsp_document_symbols, {}) vim.keymap.set('n', '<leader>fh', builtin.help_tags)
vim.keymap.set('n', '<leader>fh', builtin.help_tags, {}) vim.keymap.set('n', '<leader>fs', builtin.lsp_dynamic_workspace_symbols)
vim.keymap.set('n', '<leader>dd', builtin.diagnostics, {})
-- Use telescope for lsp definitions, calls and references -- Grep (the only one).
vim.keymap.set('n', '<leader>gd', builtin.lsp_definitions, {}) vim.keymap.set('n', '<leader>gg', builtin.live_grep)
vim.keymap.set('n', '<leader>gr', builtin.lsp_references, {})
vim.keymap.set('n', '<leader>gi', builtin.lsp_implementations, {}) -- LSP navigation.
vim.keymap.set('n', '<leader>ci', builtin.lsp_incoming_calls, {}) vim.keymap.set('n', '<leader>gd', builtin.lsp_definitions)
vim.keymap.set('n', '<leader>co', builtin.lsp_outgoing_calls, {}) 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)