From c95994536a0ffa893869f11fec8f140e5399a4fd Mon Sep 17 00:00:00 2001 From: D4VIDB2 Date: Wed, 17 Nov 2021 11:33:26 +0100 Subject: [PATCH] nvim lsp --- bash/.bashrc | 3 ++- nvim/.config/nvim/init.vim | 47 ++++++++++++++++++++++++++------------ 2 files changed, 34 insertions(+), 16 deletions(-) diff --git a/bash/.bashrc b/bash/.bashrc index eb72a55..3417e31 100644 --- a/bash/.bashrc +++ b/bash/.bashrc @@ -14,7 +14,8 @@ if [ -f ~/.shell_aliases ]; then source ~/.shell_aliases fi -export PATH=$PATH:~/.cargo/bin +export PATH=$PATH:$HOME/.cargo/bin +export PATH=$PATH:$HOME/.pub-cache/bin . "$HOME/.cargo/env" diff --git a/nvim/.config/nvim/init.vim b/nvim/.config/nvim/init.vim index d99ba2f..1137102 100644 --- a/nvim/.config/nvim/init.vim +++ b/nvim/.config/nvim/init.vim @@ -47,12 +47,12 @@ call plug#begin('~/.config/nvim/autoload/plugged') Plug 'junegunn/fzf.vim' Plug 'airblade/vim-rooter' " addon for fzf, for git projects - "Plug 'ycm-core/YouCompleteMe' - Plug 'neoclide/coc.nvim', {'branch': 'release'} + " Plug 'ycm-core/YouCompleteMe' + " Plug 'neoclide/coc.nvim', {'branch': 'release'} " Better syntax highlighting " Python: -"" Plug 'numirias/semshi', {'do': ':UpdateRemotePlugins'} + Plug 'numirias/semshi', {'do': ':UpdateRemotePlugins'} " Plug 'davidhalter/jedi-vim' " C++: @@ -363,16 +363,16 @@ endfun " - Restart -function SetupRust() +function SetupLSP() " Set completeopt to have a better completion experience " :help completeopt " menuone: popup even when there's only one match " noinsert: Do not insert text until a selection is made " noselect: Do not select, force user to select one from the menu - set completeopt=menuone,noinsert,noselect + set completeopt=menuone,noinsert,noselect,preview " Avoid showing extra messages when using completion - set shortmess+=c + "set shortmess+=c " Configure LSP through rust-tools.nvim plugin. " rust-tools will configure and enable certain LSP features for us. @@ -382,7 +382,7 @@ function SetupRust() -- nvim_lsp object local nvim_lsp = require'lspconfig' - local opts = { + nvim_lsp.rust_analyzer.setup({ tools = { autoSetHints = true, hover_with_actions = true, @@ -413,18 +413,33 @@ function SetupRust() } } }, - } + }) + + -- require('rust-tools').setup(opts) - require('rust-tools').setup(opts) + nvim_lsp.pylsp.setup({ + tools = { + autoSetHints = true, + hover_with_actions = true, + runnables = { + use_telescope = true + }, + inlay_hints = { + show_parameter_hints = false, + parameter_hints_prefix = "", + other_hints_prefix = "", + }, + }, + }) EOF + autocmd Filetype python setlocal omnifunc=v:lua.vim.lsp.omnifunc " Code navigation shortcuts " as found in :help lsp - nnoremap lua vim.lsp.buf.definition() - nnoremap K lua vim.lsp.buf.hover() - nnoremap gD lua vim.lsp.buf.implementation() + nnoremap rn lua vim.lsp.buf.rename() + nnoremap gi lua vim.lsp.buf.implementation() nnoremap lua vim.lsp.buf.signature_help() - nnoremap 1gD lua vim.lsp.buf.type_definition() + " 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() @@ -484,9 +499,11 @@ EOF " Goto previous/next diagnostic warning/error nnoremap g[ lua vim.lsp.diagnostic.goto_prev() nnoremap g] lua vim.lsp.diagnostic.goto_next() + + " colorscheme nord endfunction -:call SetupRust() +:call SetupLSP() @@ -581,7 +598,7 @@ autocmd FileType java,typescript,go,cpp,h,c :call SetupYCM() autocmd FileType html,css,js,djangohtml,py,sh,lua,php :call SetupCoC() -autocmd FileType rust :call SetupRust() +" autocmd FileType rust :call SetupRust()