From 78ac9ac39134e59a337085c6c8477643c6c9ef12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yaroslav=20de=20la=20Pe=C3=B1a=20Smirnov?= Date: Tue, 25 Jan 2022 04:22:19 +0300 Subject: Use neovim's own lsp server --- dotfiles/.config/nvim/init.vim | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) (limited to 'dotfiles/.config/nvim') diff --git a/dotfiles/.config/nvim/init.vim b/dotfiles/.config/nvim/init.vim index a58a0e1..616df31 100644 --- a/dotfiles/.config/nvim/init.vim +++ b/dotfiles/.config/nvim/init.vim @@ -24,10 +24,7 @@ call plug#begin('~/.local/share/nvim/site/plugged') Plug 'xavierd/clang_complete' Plug 'pangloss/vim-javascript' Plug 'https://gitlab.com/HiPhish/info.vim' - Plug 'autozimu/LanguageClient-neovim', { - \ 'branch': 'next', - \ 'do': 'bash install.sh', - \ } + Plug 'neovim/nvim-lspconfig' call plug#end() " Some basics: @@ -36,6 +33,7 @@ call plug#end() syntax on set foldmethod=syntax set omnifunc=syntaxcomplete#Complete + set omnifunc=v:lua.vim.lsp.omnifunc set guicursor=n-v-sm:block,i-ci-c-ve:ver25,r-cr-o:block set cursorline set redrawtime=1000 @@ -217,25 +215,24 @@ call plug#end() " Tagbar map :TagbarToggle -" LSP - let g:LanguageClient_serverCommands = { - \ 'c': ['/usr/bin/clangd', '--cross-file-rename'], - \ 'ch': ['/usr/bin/clangd', '--cross-file-rename'], - \ 'go': ['/usr/bin/gopls'], - \ 'cpp': ['/usr/bin/clangd', '--cross-file-rename'], - \ 'python': ['/usr/bin/pyls'], - \ 'rust': ['/usr/bin/rustup', 'run', 'stable', 'rls'], - \ 'javascript': ['/usr/bin/typescript-language-server', '--stdio'], - \ } - -" LanguageClient-neovim - nmap m (lcn-menu) - nmap gd (lcn-definition) - " Goyo let g:goyo_width = 100 map g :Goyo +" LSP + lua require('lspconfig').clangd.setup{filetypes = { "c", "cpp", "objc", "objcpp", "ch" }} + lua require('lspconfig').gopls.setup{} + lua require('lspconfig').pylsp.setup{} + lua require('lspconfig').rls.setup{} + lua require('lspconfig').tsserver.setup{} + +" LSP keybinds + nmap gd lua vim.lsp.buf.definition() + nmap gD lua vim.lsp.buf.declaration() + nmap K lua vim.lsp.buf.hover() + nmap n lua vim.lsp.buf.rename() + nmap b lua vim.lsp.buf.formatting() + " File format preferences autocmd FileType rust setlocal noet ci pi sts=0 ts=4 sw=4 tw=80 autocmd FileType meson setlocal noet ci pi sts=0 ts=4 sw=4 tw=80 -- cgit v1.2.3