a bit of a refactor, new telescope mappings
This commit is contained in:
parent
4496f44c49
commit
8437ec67c1
2 changed files with 26 additions and 29 deletions
11
lua/lsp.lua
11
lua/lsp.lua
|
@ -4,20 +4,13 @@ local on_attach = function(client, bufnr)
|
||||||
utils.opt("o", "omnifunc", "v:lua.vim.lsp.omnifunc")
|
utils.opt("o", "omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||||
|
|
||||||
-- Mappings.
|
-- Mappings.
|
||||||
utils.map("n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>")
|
|
||||||
utils.map("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>")
|
|
||||||
utils.map("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>")
|
|
||||||
utils.map("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>")
|
|
||||||
utils.map("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>")
|
utils.map("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>")
|
||||||
utils.map("n", "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>")
|
utils.map("n", "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>")
|
||||||
utils.map("n", "[d", "<cmd>lua vim.diagnostic.goto_prev()<CR>")
|
|
||||||
utils.map("n", "]d", "<cmd>lua vim.diagnostic.goto_next()<CR>")
|
|
||||||
utils.map("n", "[l", "<cmd>lua vim.diagnostic.show_line_diagnostics()<CR>")
|
utils.map("n", "[l", "<cmd>lua vim.diagnostic.show_line_diagnostics()<CR>")
|
||||||
utils.map("n", "]l", "<cmd>lua vim.diagnostic.set_loclist()<CR>")
|
utils.map("n", "]l", "<cmd>lua vim.diagnostic.set_loclist()<CR>")
|
||||||
utils.map("n", "<leader>a", "<cmd>lua vim.lsp.buf.code_action()<CR>")
|
utils.map("n", "<leader>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>")
|
||||||
utils.map("n", "<leader>c", "<cmd>lua vim.lsp.buf.code_action()<CR>")
|
utils.map("n", "<M-k>", "<cmd>lua vim.lsp.buf.type_definition()<CR>")
|
||||||
utils.map("n", "<M-r>", "<cmd>lua vim.lsp.buf.rename()()<CR>")
|
utils.map("n", "<M-r>", "<cmd>lua vim.lsp.buf.rename()()<CR>")
|
||||||
utils.map("n", "<M-t>", "<cmd>lua vim.lsp.buf.type_definition()<CR>")
|
|
||||||
|
|
||||||
-- list/add/remove workspace folders, not that I use them often
|
-- list/add/remove workspace folders, not that I use them often
|
||||||
utils.map("n", "<leader>wl", "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>")
|
utils.map("n", "<leader>wl", "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>")
|
||||||
|
|
|
@ -1,30 +1,34 @@
|
||||||
local telescope = require('telescope')
|
local telescope = require('telescope')
|
||||||
|
local actions = require('telescope.actions')
|
||||||
local builtin = require('telescope.builtin')
|
local builtin = require('telescope.builtin')
|
||||||
|
|
||||||
telescope.setup {
|
telescope.setup {
|
||||||
defaults = {
|
defaults = {
|
||||||
vimgrep_arguments = { 'rg',
|
live_grep_arguments = { 'rg',
|
||||||
'--hidden', '--color=never', '--no-heading',
|
'--hidden', '--no-ignore', '--color=never',
|
||||||
'--with-filename', '--line-number',
|
'--with-filename', '--line-number',
|
||||||
'--column', '--smart-case',
|
'--column', '--smart-case', '--no-heading',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
pickers = {
|
||||||
|
live_grep = {
|
||||||
|
mappings = {
|
||||||
|
i = { ["<c-f>"] = actions.to_fuzzy_refine },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
local find_files_workspace = function()
|
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
|
||||||
builtin.find_files({
|
vim.keymap.set('n', '<leader>fg', builtin.git_files, {})
|
||||||
search_dirs = vim.lsp.buf.list_workspace_folders(),
|
vim.keymap.set('n', '<leader>gg', builtin.live_grep, {})
|
||||||
prompt_prefix = "🔍",
|
vim.keymap.set('n', '<leader>bb', builtin.buffers, {})
|
||||||
})
|
vim.keymap.set('n', '<leader>hh', builtin.help_tags, {})
|
||||||
end
|
vim.keymap.set('n', '<leader>ss', builtin.lsp_dynamic_workspace_symbols, {})
|
||||||
local live_grep_workspace = function()
|
vim.keymap.set('n', '<leader>sd', builtin.lsp_document_symbols, {})
|
||||||
builtin.live_grep({
|
vim.keymap.set('n', '<leader>dd', builtin.diagnostics, {})
|
||||||
search_dirs = vim.lsp.buf.list_workspace_folders(),
|
vim.keymap.set('n', '<leader>gd', builtin.lsp_definitions, {})
|
||||||
})
|
vim.keymap.set('n', '<leader>gr', builtin.lsp_references, {})
|
||||||
end
|
vim.keymap.set('n', '<leader>gi', builtin.lsp_implementations, {})
|
||||||
|
vim.keymap.set('n', '<leader>ci', builtin.lsp_incoming_calls, {})
|
||||||
vim.keymap.set('n', '<leader>ff', find_files_workspace, {})
|
vim.keymap.set('n', '<leader>co', builtin.lsp_outgoing_calls, {})
|
||||||
vim.keymap.set('n', '<leader>fg', live_grep_workspace, {})
|
|
||||||
vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
|
|
||||||
vim.keymap.set('n', '<leader>fh', builtin.help_tags, {})
|
|
||||||
vim.keymap.set('n', '<leader>fl', builtin.git_files, {})
|
|
||||||
|
|
Reference in a new issue