diff options
| -rw-r--r-- | .config/nvim/lazy-lock.json | 1 | ||||
| -rw-r--r-- | .config/nvim/lua/vimrc/plugins.lua | 30 |
2 files changed, 30 insertions, 1 deletions
diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index 0605dae..ad98671 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -14,6 +14,7 @@ "hop.nvim": { "branch": "v2", "commit": "90db1b2c61b820e230599a04fedcd2679e64bd07" }, "indent-blankline.nvim": { "branch": "master", "commit": "018bd04d80c9a73d399c1061fa0c3b14a7614399" }, "lazy.nvim": { "branch": "main", "commit": "57cce98dfdb2f2dd05a0567d89811e6d0505e13b" }, + "nvim-lspconfig": { "branch": "master", "commit": "5da57456597ac2f25f20d6ecfae7b7c9cbd01fc6" }, "nvim-treesitter": { "branch": "master", "commit": "411e771d511442ab81670701f5c830f6c74aadd7" }, "nvim-yati": { "branch": "main", "commit": "8240f369d47c389ac898f87613e0901f126b40f3" }, "playground": { "branch": "master", "commit": "4044b53c4d4fcd7a78eae20b8627f78ce7dc6f56" }, diff --git a/.config/nvim/lua/vimrc/plugins.lua b/.config/nvim/lua/vimrc/plugins.lua index 544364c..61c62f2 100644 --- a/.config/nvim/lua/vimrc/plugins.lua +++ b/.config/nvim/lua/vimrc/plugins.lua @@ -683,10 +683,38 @@ return { vim.g.yankround_use_region_hl = true end, }, - -- }}} + -- LSP {{{1 + -- Collection of common LSP configurations. + { + 'neovim/nvim-lspconfig', + config = function() + local lspconfig = require('lspconfig') + + if vim.fn.executable('typescript-language-server') == 1 then + lspconfig.tsserver.setup({}) + end + if vim.fn.executable('gopls') == 1 then + lspconfig.gopls.setup({}) + end + + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('UserLspConfig', {}), + callback = function(e) + vim.bo[e.buf].omnifunc = 'v:lua.vim.lsp.omnifunc' + + local opts = { buffer = e.buf } + vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts) + vim.keymap.set('n', '<space>f', function() + vim.lsp.buf.format({ async = true }) + end, opts) + end, + }) + end, + }, -- *Magic* {{{1 -- Integration with GitHub Copilot (https://docs.github.com/en/copilot) { 'github/copilot.vim', }, + -- }}} } |
