From 54f4062872010a3b0fb3e80bef338b2ea8893b8c Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Wed, 12 May 2021 19:00:31 -0400 Subject: [PATCH] switch to nvim-lspconfig --- nvim.configlink/coc-settings.json | 7 ---- nvim.configlink/init.vim | 1 - nvim.configlink/settings/coc.vim | 61 ---------------------------- nvim.configlink/settings/custom.vim | 3 ++ nvim.configlink/settings/general.vim | 9 +++- nvim.configlink/settings/plugins.vim | 29 +++++++++---- 6 files changed, 33 insertions(+), 77 deletions(-) delete mode 100644 nvim.configlink/coc-settings.json delete mode 100644 nvim.configlink/settings/coc.vim diff --git a/nvim.configlink/coc-settings.json b/nvim.configlink/coc-settings.json deleted file mode 100644 index be95449..0000000 --- a/nvim.configlink/coc-settings.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "rust-analyzer.serverPath": "/usr/local/bin/rust-analyzer", - "rust-analyzer.checkOnSave.enable": true, - "diagnostic-languageserver.filetypes": { - "sh": "shellcheck" - } -} diff --git a/nvim.configlink/init.vim b/nvim.configlink/init.vim index 14c3b11..710b8fe 100644 --- a/nvim.configlink/init.vim +++ b/nvim.configlink/init.vim @@ -11,4 +11,3 @@ source $HOME/.config/nvim/settings/polyglot.vim " Polyglot plugin settings source $HOME/.config/nvim/settings/vimwiki.vim " VimWiki plugin settings source $HOME/.config/nvim/settings/quickscope.vim " Quickscope plugin settings source $HOME/.config/nvim/settings/lightline.vim " Lightline plugin settings -source $HOME/.config/nvim/settings/coc.vim " CoC plugins settings diff --git a/nvim.configlink/settings/coc.vim b/nvim.configlink/settings/coc.vim deleted file mode 100644 index d4a1e5d..0000000 --- a/nvim.configlink/settings/coc.vim +++ /dev/null @@ -1,61 +0,0 @@ -" CoC Settings -"------------- - -" Extensions to auto-install and enable -let g:coc_global_extensions = [ - \ 'coc-rust-analyzer', - \ 'coc-pairs', - \ 'coc-diagnostic', -\ ] - -" Set tab to completion -inoremap - \ pumvisible() ? "\" : - \ check_back_space() ? "\" : - \ coc#refresh() -inoremap pumvisible() ? "\" : "\" - -function! s:check_back_space() abort - let col = col('.') - 1 - return !col || getline('.')[col - 1] =~# '\s' -endfunction - -inoremap pumvisible() ? coc#_select_confirm() - \: "\u\\=coc#on_enter()\" - -" Use `[g` and `]g` to navigate diagnostics -" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list. -nmap [g (coc-diagnostic-prev) -nmap ]g (coc-diagnostic-next) - -" GoTo code navigation. -nmap gd (coc-definition) -nmap gy (coc-type-definition) -nmap gi (coc-implementation) -nmap gr (coc-references) - -" Use K to show documentation in preview window. -nnoremap K :call show_documentation() - -function! s:show_documentation() - if (index(['vim','help'], &filetype) >= 0) - execute 'h '.expand('') - else - call CocAction('doHover') - endif -endfunction - -" Highlight the symbol and its references when holding the cursor. -" Uses updatetime for delay before showing info. -autocmd CursorHold * silent call CocActionAsync('highlight') - -" Symbol renaming. -nmap rn (coc-rename) - -" Use CTRL-S for selections ranges. -" Requires 'textDocument/selectionRange' support of LS, ex: coc-tsserver -nmap (coc-range-select) -xmap (coc-range-select) - -" Use autocmd to force lightline update. -autocmd User CocStatusChange,CocDiagnosticChange call lightline#update() diff --git a/nvim.configlink/settings/custom.vim b/nvim.configlink/settings/custom.vim index c94b6dd..87cd2ca 100644 --- a/nvim.configlink/settings/custom.vim +++ b/nvim.configlink/settings/custom.vim @@ -72,6 +72,9 @@ nnoremap wh :split " Close all other splits nnoremap wm :only +" Jump around +nnoremap :HopWord + " Zoom / Restore window. " https://stackoverflow.com/a/26551079 function! s:ZoomToggle() abort diff --git a/nvim.configlink/settings/general.vim b/nvim.configlink/settings/general.vim index f1f53dd..7d74bd1 100644 --- a/nvim.configlink/settings/general.vim +++ b/nvim.configlink/settings/general.vim @@ -30,7 +30,8 @@ set updatetime=300 " Faster diagnostics set mouse=nv " Mouse interaction / scrolling " Neovim only -set inccommand=split " Live preview search and replace +set inccommand=split " Live preview search and replace +set completeopt=menuone,noselect " Required for nvim-compe completion " Remember last position when reopening file if has("autocmd") @@ -63,3 +64,9 @@ au BufRead,BufNewFile *ignore.*link setfiletype gitignore au BufRead,BufNewFile gitconfig.*link setfiletype gitconfig au BufRead,BufNewFile *.toml.*link setfiletype toml au BufRead,BufNewFile .env* set ft=text | set syntax=sh + +" Highlight when yanking +au TextYankPost * silent! lua vim.highlight.on_yank { timeout = 250 } + +" Auto-pairs +let g:AutoPairsFlyMode = 1 diff --git a/nvim.configlink/settings/plugins.vim b/nvim.configlink/settings/plugins.vim index 2ca8b17..6d75a26 100644 --- a/nvim.configlink/settings/plugins.vim +++ b/nvim.configlink/settings/plugins.vim @@ -12,14 +12,18 @@ endif call plug#begin('$HOME/.config/nvim/plugged') " Core plugins -Plug 'morhetz/gruvbox' " Colorscheme -Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } " Install fzf (required) +Plug 'nvim-lua/plenary.nvim' " Prerequisite library for other plugins +Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } " Install fzf (prerequisite for fzf.vim) Plug 'junegunn/fzf.vim' " Actual fuzzyfinder +Plug 'morhetz/gruvbox' " Colorscheme Plug 'tpope/vim-surround' " Enables paren editing Plug 'sheerun/vim-polyglot' " Syntax for every language -Plug 'airblade/vim-gitgutter' " Git next to line numbers +Plug 'lewis6991/gitsigns.nvim' " Git next to line numbers Plug 'tpope/vim-commentary' " Use gc or gcc to comment Plug 'phaazon/hop.nvim' " Quick jump around the buffer +Plug 'neovim/nvim-lspconfig' " Language server linting +Plug 'jiangmiao/auto-pairs' " Parentheses +Plug 'hrsh7th/nvim-compe' " Auto-complete " Ancillary plugins Plug 'godlygeek/tabular' " Spacing and alignment @@ -27,13 +31,24 @@ Plug 'unblevable/quick-scope' " Hints for f and t Plug 'vimwiki/vimwiki' " Wiki Markdown System Plug 'airblade/vim-rooter' " Change directory to git route Plug 'tpope/vim-fugitive' " Other git commands -Plug 'machakann/vim-highlightedyank' " Highlight text when copied Plug 'itchyny/lightline.vim' " Status bar Plug 'tpope/vim-eunuch' " File manipulation in Vim Plug 'tpope/vim-vinegar' " Fixes netrw file explorer Plug 'christoomey/vim-tmux-navigator' " Hotkeys for tmux panes -" CoC (Language Server Protocol, requires NodeJS) -Plug 'neoclide/coc.nvim', {'branch': 'release'} " Code completion - call plug#end() + +" Enable plugins +lua << EOF +require('lspconfig').rust_analyzer.setup{} +require('lspconfig').pyls.setup{} +require('gitsigns').setup() +require'compe'.setup({ + enabled = true, + source = { + path = true, + buffer = true, + nvim_lsp = true, + }, +}) +EOF