From 69654597d2fa4f2604685ca84839e41861c6b4c9 Mon Sep 17 00:00:00 2001 From: Sanchayan Maity Date: Sun, 24 May 2020 16:57:26 +0530 Subject: [PATCH] nvim: Use in built LSP for rust While at it, use wombat colorscheme for Rust. Signed-off-by: Sanchayan Maity --- nvim/.config/nvim/after/ftplugin/rust.vim | 6 +----- nvim/.config/nvim/after/plugin/nvim_lsp.vim | 9 +++++++++ nvim/.config/nvim/init.vim | 4 +++- nvim/.config/nvim/plugin_settings.vim | 9 +++++++++ 4 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 nvim/.config/nvim/after/plugin/nvim_lsp.vim diff --git a/nvim/.config/nvim/after/ftplugin/rust.vim b/nvim/.config/nvim/after/ftplugin/rust.vim index c6c1987..5d089a6 100644 --- a/nvim/.config/nvim/after/ftplugin/rust.vim +++ b/nvim/.config/nvim/after/ftplugin/rust.vim @@ -1,8 +1,4 @@ -nmap gd (rust-def) -nmap K (rust-doc) -nmap gv (rust-def-vertical) -nmap gh (rust-def-split) -nmap gt (rust-def-tab) +colorscheme wombat augroup rust_maps au! diff --git a/nvim/.config/nvim/after/plugin/nvim_lsp.vim b/nvim/.config/nvim/after/plugin/nvim_lsp.vim new file mode 100644 index 0000000..59e7097 --- /dev/null +++ b/nvim/.config/nvim/after/plugin/nvim_lsp.vim @@ -0,0 +1,9 @@ +nnoremap gd lua vim.lsp.buf.declaration() +nnoremap lua vim.lsp.buf.definition() +nnoremap K lua vim.lsp.buf.hover() +nnoremap gD lua vim.lsp.buf.implementation() +nnoremap lua vim.lsp.buf.signature_help() +nnoremap 1gD lua vim.lsp.buf.type_definition() +nnoremap gr lua vim.lsp.buf.references() +nnoremap g0 lua vim.lsp.buf.document_symbol() +nnoremap gW lua vim.lsp.buf.workspace_symbol() diff --git a/nvim/.config/nvim/init.vim b/nvim/.config/nvim/init.vim index e67f7de..00746cb 100644 --- a/nvim/.config/nvim/init.vim +++ b/nvim/.config/nvim/init.vim @@ -61,6 +61,9 @@ Plug 'christoomey/vim-system-copy' Plug 'dhruvasagar/vim-markify' " Toggle terminal Plug 'caenrique/nvim-toggle-terminal' +" LSP +Plug 'neovim/nvim-lsp' +Plug 'haorenW1025/diagnostic-nvim' " Language support & syntax highlighting " Haskell Plug 'neovimhaskell/haskell-vim' @@ -69,7 +72,6 @@ Plug 'godlygeek/tabular', { 'for': 'haskell' } Plug 'ndmitchell/ghcid', { 'rtp': 'plugins/nvim' } " Rust Plug 'rust-lang/rust.vim', { 'for': 'rust' } -Plug 'racer-rust/vim-racer', { 'for': 'rust' } " Purescript Plug 'purescript-contrib/purescript-vim' Plug 'frigoeu/psc-ide-vim' diff --git a/nvim/.config/nvim/plugin_settings.vim b/nvim/.config/nvim/plugin_settings.vim index 3040c69..469ac8a 100644 --- a/nvim/.config/nvim/plugin_settings.vim +++ b/nvim/.config/nvim/plugin_settings.vim @@ -61,3 +61,12 @@ let g:cpp_concepts_highlight = 1 let g:markify_error_text = 'E' let g:markify_warning_text = 'W' let g:markify_info_text = 'I' + +" Neovim LSP Diagnostics +let g:diagnostic_enable_virtual_text = 1 +let g:diagnostic_show_sign = 1 +let g:diagnostic_auto_popup_while_jump = 1 +let g:diagnostic_insert_delay = 1 + +lua require'nvim_lsp'.rust_analyzer.setup{} +lua require'nvim_lsp'.rust_analyzer.setup{on_attach=require'diagnostic'.on_attach}