summaryrefslogtreecommitdiffstats
path: root/.config/nvim/lua/plugin_settings.lua
diff options
context:
space:
mode:
authorYigit Sever2022-04-06 23:59:31 +0300
committerYigit Sever2022-04-13 23:13:39 +0300
commit49c69503394a55512ecbaf73612f7f5cc3a05da9 (patch)
tree8d45e386f3da84c5d29757f42e1744b898c142f7 /.config/nvim/lua/plugin_settings.lua
parent0758709b29bc5259b70980a10ec14a6542dcb465 (diff)
downloaddotfiles-49c69503394a55512ecbaf73612f7f5cc3a05da9.tar.gz
dotfiles-49c69503394a55512ecbaf73612f7f5cc3a05da9.tar.bz2
dotfiles-49c69503394a55512ecbaf73612f7f5cc3a05da9.zip
nvim: update nvim_lsp mappings
Diffstat (limited to '.config/nvim/lua/plugin_settings.lua')
-rw-r--r--.config/nvim/lua/plugin_settings.lua45
1 files changed, 21 insertions, 24 deletions
diff --git a/.config/nvim/lua/plugin_settings.lua b/.config/nvim/lua/plugin_settings.lua
index 0eb0e94..cb27343 100644
--- a/.config/nvim/lua/plugin_settings.lua
+++ b/.config/nvim/lua/plugin_settings.lua
@@ -319,34 +319,31 @@ cmp.setup({
319-- nvim-lsp {{{ -- 319-- nvim-lsp {{{ --
320local nvim_lsp = require('lspconfig') 320local nvim_lsp = require('lspconfig')
321 321
322local on_attach = function(client, bufnr) 322-- Mappings.
323 local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end 323local opts = { noremap=true, silent=true }
324 local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end 324vim.api.nvim_set_keymap('n', '<leader>e', '<cmd>lua vim.diagnostic.open_float()<CR>', opts)
325vim.api.nvim_set_keymap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts)
326vim.api.nvim_set_keymap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts)
327vim.api.nvim_set_keymap('n', '<leader>q', '<cmd>lua vim.diagnostic.setloclist()<CR>', opts)
325 328
329local on_attach = function(client, bufnr)
326 -- Enable completion triggered by <c-x><c-o> 330 -- Enable completion triggered by <c-x><c-o>
327 buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') 331 vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
328
329 -- Mappings.
330 local opts = { noremap=true, silent=true }
331 332
332 -- See `:help vim.lsp.*` for documentation on any of the below functions 333 -- See `:help vim.lsp.*` for documentation on any of the below functions
333 buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts) 334 vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
334 buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts) 335 vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
335 buf_set_keymap('n', 'vh', '<cmd>lua vim.lsp.buf.hover()<CR>', opts) 336 vim.api.nvim_buf_set_keymap(bufnr, 'n', 'vh', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
336 buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts) 337 vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gh', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
337 buf_set_keymap('n', 'gh', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts) 338 vim.api.nvim_buf_set_keymap(bufnr, 'n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
338 buf_set_keymap('n', '<leader>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts) 339 vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
339 buf_set_keymap('n', '<leader>wd', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts) 340 vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
340 buf_set_keymap('n', '<leader>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts) 341 vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
341 buf_set_keymap('n', '<leader>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts) 342 vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
342 buf_set_keymap('n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts) 343 vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
343 buf_set_keymap('n', '<leader>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts) 344 vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
344 buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts) 345 vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
345 buf_set_keymap('n', '<leader>d', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts) 346 vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>fm', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
346 buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
347 buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
348 buf_set_keymap('n', '<leader>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
349 buf_set_keymap('n', '<leader>fm', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
350end 347end
351 348
352local servers = { 'rust_analyzer', 'jedi_language_server', 'texlab', 'clangd' } 349local servers = { 'rust_analyzer', 'jedi_language_server', 'texlab', 'clangd' }