diff options
| author | Robert Günzler <r@gnzler.io> | 2021-06-11 13:05:05 +0200 |
|---|---|---|
| committer | Robert Günzler <r@gnzler.io> | 2021-06-11 13:05:05 +0200 |
| commit | 7f68dd013f46de0bed23452b89879038110114a6 (patch) | |
| tree | 72abe3e569b076e11324dd4f879c25c5b3807598 /.vim/lua/plugins/_lsp.lua | |
| parent | 5e79cfa901f1b1b89dc1a1a351d7708d13a5e042 (diff) | |
vim: refactor nvim-completion configuration
Diffstat (limited to '.vim/lua/plugins/_lsp.lua')
| -rw-r--r-- | .vim/lua/plugins/_lsp.lua | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/.vim/lua/plugins/_lsp.lua b/.vim/lua/plugins/_lsp.lua index bf1cc6d..9c52998 100644 --- a/.vim/lua/plugins/_lsp.lua +++ b/.vim/lua/plugins/_lsp.lua @@ -11,25 +11,24 @@ local my_attach = function(client) require 'completion'.on_attach(client) -- lsp mappings - nnoremap { 'K', function() vim.lsp.buf.hover() end } - nnoremap { '<C-]>', function() vim.lsp.buf.definition() end } - nnoremap { 'gd', function() vim.lsp.buf.definition() end } - nnoremap { 'grr', function() vim.lsp.buf.rename() end } - nnoremap { '<c-h>', function() vim.lsp.buf.signature_help() end } - nnoremap { ']d', function() vim.lsp.diagnostic.goto_next() end } - nnoremap { '[d', function() vim.lsp.diagnostic.goto_prev() end } - - nnoremap { '<leader>f', function() vim.lsp.buf.formatting() end } - - -- nnoremap { 'g0', function() vim.lsp.buf.document_symbol() end } - nnoremap { 'gR', function() vim.lsp.buf.references() end } - nnoremap { 'gW', function() vim.lsp.buf.workspace_symbol() end } - nnoremap { 'gD', function() vim.lsp.buf.declaration() end } - nnoremap { 'gT', function() vim.lsp.buf.type_definition() end } - nnoremap { 'gI', function() vim.lsp.buf.implementation() end } + nnoremap { 'K' , vim.lsp.buf.hover } + nnoremap { '<C-]>' , vim.lsp.buf.definition } + nnoremap { 'gd' , vim.lsp.buf.definition } + nnoremap { 'grr' , vim.lsp.buf.rename } + nnoremap { '<c-h>' , vim.lsp.buf.signature_help } + nnoremap { ']d' , vim.lsp.diagnostic.goto_next } + nnoremap { '[d' , vim.lsp.diagnostic.goto_prev } + + nnoremap { '<leader>f' , vim.lsp.buf.formatting } + -- nnoremap { 'g0', vim.lsp.buf.document_symbol } + nnoremap { 'gR' , vim.lsp.buf.references } + nnoremap { 'gW' , vim.lsp.buf.workspace_symbol } + nnoremap { 'gD' , vim.lsp.buf.declaration } + nnoremap { 'gT' , vim.lsp.buf.type_definition } + nnoremap { 'gI' , vim.lsp.buf.implementation } -- nnoremap <silent> ;s <cmd> lua vim.lsp.buf.signature_help()<CR> - nnoremap { '<leader>d', function() vim.lsp.diagnostic.show_line_diagnostics() end } + nnoremap { '<leader>d' , vim.lsp.diagnostic.show_line_diagnostics } u.augroup2 { lsp_user = { @@ -40,9 +39,9 @@ local my_attach = function(client) } end --- handler overwrites {{{ +-- handler overwrites -- configure builtin diagnositcs -vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( +vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( -- {{{ vim.lsp.diagnostic.on_publish_diagnostics, { virtual_text = false, signs = true, @@ -50,10 +49,11 @@ vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( update_in_insert = true, } ) +-- }}} -- overwrite codeAction handler to not ask for confirmation if only a single -- action is given -vim.lsp.handlers["textDocument/codeAction"] = function(_, _, actions) +vim.lsp.handlers["textDocument/codeAction"] = function(_, _, actions) -- {{{ if actions == nil or vim.tbl_isempty(actions) then -- skip printing 'no code actions available' return |