added format on save and go to error keybind

This commit is contained in:
Afonso Franco 2022-11-21 23:12:47 +00:00
parent 22540294a8
commit a78e6db309
Signed by: afonso
GPG key ID: C459E0BB3DCEE899

View file

@ -28,7 +28,13 @@ local on_attach = function(client, bufnr)
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
vim.keymap.set('n', '<space>f', function() vim.lsp.buf.format { async = true } end, bufopts)
vim.keymap.set('n', '<space>ge', function () vim.diagnostic.goto_next() end, bufopts)
vim.keymap.set('n', '<space>gE', function () vim.diagnostic.goto_prev() end, bufopts)
vim.keymap.set('n', '<space>fo', function() vim.lsp.buf.format { async = true } end, bufopts)
vim.api.nvim_create_autocmd('BufWritePre', {
pattern = '<buffer>',
callback = function() vim.lsp.buf.format({ async = true }) end
})
end
local lsp = require "lspconfig"