diff options
| author | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2022-08-14 18:27:48 +0200 |
|---|---|---|
| committer | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2022-08-14 18:27:48 +0200 |
| commit | c8d1a3590261dbd42ff1daaf238c9187db1770ec (patch) | |
| tree | 68237ec620df678561b67bca5045347b3c73e82e /after/plugin/lsp.lua | |
| parent | e830754a989b3bb4e8dac27356984cad1f67f9f2 (diff) | |
| download | nvim-conf-c8d1a3590261dbd42ff1daaf238c9187db1770ec.tar.gz nvim-conf-c8d1a3590261dbd42ff1daaf238c9187db1770ec.zip | |
configure to have format and actions in all buffers
Diffstat (limited to 'after/plugin/lsp.lua')
| -rw-r--r-- | after/plugin/lsp.lua | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua index 764d3f3..302607b 100644 --- a/after/plugin/lsp.lua +++ b/after/plugin/lsp.lua @@ -21,18 +21,23 @@ local filetype_attach = setmetatable({ end, }) + +-- Since I use null os this allows to have the format and actions +-- in all buffers not just configured servers +vim.keymap.set("n", "<leader>vca", vim.lsp.buf.code_action, {}) + +vim.keymap.set("n", "<leader>vf", function() + return vim.lsp.buf.format({ async = true }) +end, {}) + local function on_attach(client) local filetype = vim.api.nvim_buf_get_option(0, "filetype") -- keymaps for lsp vim.keymap.set("n", "K", vim.lsp.buf.hover, { buffer = 0 }) vim.keymap.set("n", "<c-]>", vim.lsp.buf.definition, { buffer = 0 }) vim.keymap.set("n", "<leader>vrn", vim.lsp.buf.rename, { buffer = 0 }) - vim.keymap.set("n", "<leader>vf", function() - return vim.lsp.buf.format({ async = true }) - end, { buffer = 0 }) vim.keymap.set("n", "<leader>vn", vim.diagnostic.goto_next, { buffer = 0 }) vim.keymap.set("n", "<leader>vp", vim.diagnostic.goto_prev, { buffer = 0 }) - vim.keymap.set("n", "<leader>vca", vim.lsp.buf.code_action, { buffer = 0 }) vim.keymap.set("i", "<c-h>", vim.lsp.buf.signature_help, { buffer = 0 }) vim.keymap.set("n", "<leader>vo", ":LspRestart<cr>", { noremap = true }) |