diff options
| author | nsfisis <nsfisis@gmail.com> | 2023-07-17 00:28:05 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2023-08-19 22:29:39 +0900 |
| commit | 182f8ab51baeda68c6892f4417de93326a335819 (patch) | |
| tree | 7e1f5a2e7f99107cec153ab7d629a2233cfe1935 /.config/nvim/lua/vimrc/plugins.lua | |
| parent | cddffa79d48087a13965e3605dea667a6fd28801 (diff) | |
| download | dotfiles-182f8ab51baeda68c6892f4417de93326a335819.tar.gz dotfiles-182f8ab51baeda68c6892f4417de93326a335819.tar.zst dotfiles-182f8ab51baeda68c6892f4417de93326a335819.zip | |
neovim: install nvim-lspconfig
Diffstat (limited to '.config/nvim/lua/vimrc/plugins.lua')
| -rw-r--r-- | .config/nvim/lua/vimrc/plugins.lua | 30 |
1 files changed, 29 insertions, 1 deletions
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', }, + -- }}} } |
