diff --git a/config/init.lua b/config/init.lua index e704faa..cd37ed9 100644 --- a/config/init.lua +++ b/config/init.lua @@ -96,10 +96,13 @@ lspconfig.gopls.setup{ } -- C/C++ -lspconfig.clangd.setup{} +lspconfig.clangd.setup{ + on_attach = on_attach, +} -- Lua lspconfig.lua_ls.setup{ + on_attach = on_attach, settings = { Lua = { diagnostics = {globals = {'vim', 'opts'}}, @@ -111,13 +114,19 @@ lspconfig.lua_ls.setup{ } -- Rust -lspconfig.rust_analyzer.setup{} +lspconfig.rust_analyzer.setup{ + on_attach = on_attach, +} -- Python -lspconfig.pylsp.setup{} +lspconfig.pylsp.setup{ + on_attach = on_attach, +} -- TypeScript -lspconfig.tsserver.setup{} +lspconfig.tsserver.setup{ + on_attach = on_attach, +} -- Fix virtual text going off screen vim.diagnostic.config({ @@ -129,19 +138,19 @@ vim.diagnostic.config({ }) -vim.api.nvim_create_autocmd('LspAttach', { - callback = function(ev) - local opts = { buffer = ev.buf } - -- error viewing - vim.keymap.set('n', 'e', vim.diagnostic.open_float, opts) - vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts) - vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts) - -- def viewing/rename - vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) - vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) - vim.keymap.set('n', 'rn', vim.lsp.buf.rename, opts) - vim.keymap.set('n', 'H', vim.lsp.buf.hover, opts) - end, -}) +-- vim.api.nvim_create_autocmd('LspAttach', { +-- callback = function(ev) +-- local opts = { buffer = ev.buf } +-- -- error viewing +-- vim.keymap.set('n', 'e', vim.diagnostic.open_float, opts) +-- vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts) +-- vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts) +-- -- def viewing/rename +-- vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) +-- vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) +-- vim.keymap.set('n', 'rn', vim.lsp.buf.rename, opts) +-- vim.keymap.set('n', 'H', vim.lsp.buf.hover, opts) +-- end, +-- })