Add and configure Telescope

This commit is contained in:
Steins7 2023-07-08 13:21:16 +02:00
parent b1ceb62e46
commit 7ed76583a0

View File

@ -22,10 +22,11 @@ local lsp_on_attach = function(_, bufnr)
-- Define standard LSP shortcuts
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
nmap('gd', vim.lsp.buf.definition, '[G]oto [d]efinition')
nmap('gr', vim.lsp.buf.references, '[G]oto [R]eferences')
nmap('gc', vim.lsp.buf.outgoing_calls, '[G]oto Outgoing [C]alls')
nmap('gt', vim.lsp.buf.type_definition, '[G]oto [T]ype definition')
-- these actions are now handled by Telescope
-- nmap('gd', vim.lsp.buf.definition, '[G]oto [d]efinition')
-- nmap('gr', vim.lsp.buf.references, '[G]oto [R]eferences')
-- nmap('gc', vim.lsp.buf.outgoing_calls, '[G]oto Outgoing [C]alls')
-- nmap('gt', vim.lsp.buf.type_definition, '[G]oto [T]ype definition')
-- See `:help K` for why this keymap
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
@ -46,7 +47,7 @@ local function manage_plugins()
vim.g.rnvimr_action = {
['<C-t>'] = "NvimEdit tabedit",
['<C-x>'] = "NvimEdit split",
['<C-w>'] = "NvimEdit vsplit",
['<C-v>'] = "NvimEdit vsplit",
}
end
},
@ -211,6 +212,54 @@ local function manage_plugins()
vim.api.nvim_set_keymap('n', '<leader>t', ":TagbarToggle<cr>", {})
end
},
["https://github.com/nvim-telescope/telescope.nvim.git"] = {
packadd_after = {
["https://github.com/nvim-lua/plenary.nvim.git"] = true,
},
packadd_hook = function()
require("telescope").setup{
defaults = {
-- Default configuration for telescope goes here:
-- config_key = value,
mappings = {
i = {
-- map actions.which_key to <C-h> (default: <C-/>)
-- actions.which_key shows the mappings for your picker,
-- e.g. git_{create, delete, ...}_branch for the git_branches picker
["<C-h>"] = "which_key"
}
}
},
pickers = {
-- Default configuration for builtin pickers goes here:
-- picker_name = {
-- picker_config_key = value,
-- ...
-- }
-- Now the picker_config_key will be applied every time you call this
-- builtin picker
},
extensions = {
-- Your extension configuration goes here:
-- extension_name = {
-- extension_config_key = value,
-- }
-- please take a look at the readme of the extension you want to configure
}
}
vim.api.nvim_set_keymap('n', 'tf', ":Telescope find_files<cr>", {})
vim.api.nvim_set_keymap('n', 'tg', ":Telescope live_grep<cr>", {})
vim.api.nvim_set_keymap('n', 'ts', ":Telescope grep_string<cr>", {})
vim.api.nvim_set_keymap('n', 'tt', ":Telescope tags<cr>", {})
vim.api.nvim_set_keymap('n', 'tc', ":Telescope git_commits<cr>", {})
vim.api.nvim_set_keymap('n', 'ta', ":Telescope git_status<cr>", {})
vim.api.nvim_set_keymap('n', 'td', ":Telescope lsp_definitions<cr>", {})
vim.api.nvim_set_keymap('n', 'tr', ":Telescope lsp_references<cr>", {})
vim.api.nvim_set_keymap('n', 'tc', ":Telescope lsp_outgoing_calls<cr>", {})
vim.api.nvim_set_keymap('n', 'te', ":Telescope diagnostics<cr>", {})
end
},
-- Git integration
["https://github.com/tpope/vim-fugitive.git"] = {},