From ca6da1729156f74bb36ba94a864ab5e39e78ae3b Mon Sep 17 00:00:00 2001 From: Guangxiong Lin Date: Sat, 4 Jun 2022 16:53:35 +0800 Subject: Try using nvim --- .vim/after/plugin/nvim-lsp.vim | 59 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .vim/after/plugin/nvim-lsp.vim (limited to '.vim/after/plugin/nvim-lsp.vim') diff --git a/.vim/after/plugin/nvim-lsp.vim b/.vim/after/plugin/nvim-lsp.vim new file mode 100644 index 0000000..f6d23c3 --- /dev/null +++ b/.vim/after/plugin/nvim-lsp.vim @@ -0,0 +1,59 @@ +if !has('nvim') + finish +endif + +packadd nvim-lspconfig +packadd cmp-nvim-lsp + +lua <', vim.lsp.buf.signature_help, bufopts) + -- vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, bufopts) + -- vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, bufopts) + -- vim.keymap.set('n', 'wl', function() + -- print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + -- end, bufopts) + vim.keymap.set('n', 'gy', vim.lsp.buf.type_definition, bufopts) + vim.keymap.set('n', 'rn', vim.lsp.buf.rename, bufopts) + -- vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, bufopts) + vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) + -- vim.keymap.set('n', 'f', vim.lsp.buf.formatting, bufopts) + + vim.cmd [[ + autocmd! BufWritePre *.go,*.rs lua vim.lsp.buf.formatting_sync(nil, 1000) + ]] + +end + +local servers = { 'clangd', 'gopls' , 'gdscript', 'pylsp' } + +for _, lsp in pairs(servers) do + lspconfig[lsp].setup{ + on_attach = on_attach, + capabilities = capabilities, + } +end + +EOF -- cgit v1.2.3