chore: move to mappings
This commit is contained in:
parent
49ca477c15
commit
a9d6652166
@ -23,30 +23,8 @@ function M.config()
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
capabilities = cmp_nvim_lsp.default_capabilities(capabilities)
|
||||
|
||||
local function lsp_keymaps(bufnr)
|
||||
local opt = { noremap = true, silent = true }
|
||||
local keymap = vim.api.nvim_buf_set_keymap
|
||||
keymap(bufnr, 'n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opt)
|
||||
keymap(bufnr, 'n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opt)
|
||||
keymap(bufnr, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opt)
|
||||
keymap(bufnr, 'n', 'gI', '<cmd>lua vim.lsp.buf.implementation()<CR>', opt)
|
||||
keymap(bufnr, 'n', 'gr', '<cmd>TroubleToggle lsp_references<CR>', opt)
|
||||
keymap(bufnr, 'n', 'gl', '<cmd>lua vim.diagnostic.open_float()<CR>', opt)
|
||||
keymap(bufnr, 'n', '<leader>lf', '<cmd>lua vim.lsp.buf.format { async = true }<cr>', opt)
|
||||
keymap(bufnr, 'n', '<leader>li', '<cmd>LspInfo<cr>', opt)
|
||||
keymap(bufnr, 'n', '<leader>lI', '<cmd>LspInstallInfo<cr>', opt)
|
||||
keymap(bufnr, 'n', '<leader>la', '<cmd>lua vim.lsp.buf.code_action()<cr>', opt)
|
||||
keymap(bufnr, 'n', '<leader>lj', '<cmd>lua vim.diagnostic.goto_next({buffer=0})<cr>', opt)
|
||||
keymap(bufnr, 'n', '<leader>lk', '<cmd>lua vim.diagnostic.goto_prev({buffer=0})<cr>', opt)
|
||||
keymap(bufnr, 'n', '<leader>lr', '<cmd>lua vim.lsp.buf.rename()<cr>', opt)
|
||||
keymap(bufnr, 'n', '<leader>ls', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opt)
|
||||
keymap(bufnr, 'n', '<leader>lq', '<cmd>lua vim.diagnostic.setloclist()<CR>', opt)
|
||||
keymap(bufnr, 'n', '<leader>e', '<cmd>lua vim.diagnostic.open_float()<CR>', opt)
|
||||
end
|
||||
|
||||
local on_attach = function(client, bufnr)
|
||||
--[[ vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') ]]
|
||||
lsp_keymaps(bufnr)
|
||||
if client.name == 'jdt.ls' then
|
||||
client.server_capabilities.documentFormattingProvider = false
|
||||
vim.lsp.codelens.refresh()
|
||||
|
Loading…
Reference in New Issue
Block a user