switch to nvim-lspconfig

This commit is contained in:
Noah Masur 2021-05-12 19:00:31 -04:00
parent 4f277c457f
commit 54f4062872
6 changed files with 33 additions and 77 deletions

View File

@ -1,7 +0,0 @@
{
"rust-analyzer.serverPath": "/usr/local/bin/rust-analyzer",
"rust-analyzer.checkOnSave.enable": true,
"diagnostic-languageserver.filetypes": {
"sh": "shellcheck"
}
}

View File

@ -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/vimwiki.vim " VimWiki plugin settings
source $HOME/.config/nvim/settings/quickscope.vim " Quickscope 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/lightline.vim " Lightline plugin settings
source $HOME/.config/nvim/settings/coc.vim " CoC plugins settings

View File

@ -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 <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
" Use `[g` and `]g` to navigate diagnostics
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list.
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)
" GoTo code navigation.
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" Use K to show documentation in preview window.
nnoremap <silent> K :call <SID>show_documentation()<CR>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
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 <leader>rn <Plug>(coc-rename)
" Use CTRL-S for selections ranges.
" Requires 'textDocument/selectionRange' support of LS, ex: coc-tsserver
nmap <silent> <C-s> <Plug>(coc-range-select)
xmap <silent> <C-s> <Plug>(coc-range-select)
" Use autocmd to force lightline update.
autocmd User CocStatusChange,CocDiagnosticChange call lightline#update()

View File

@ -72,6 +72,9 @@ nnoremap <Leader>wh :split<cr>
" Close all other splits " Close all other splits
nnoremap <Leader>wm :only<cr> nnoremap <Leader>wm :only<cr>
" Jump around
nnoremap <Leader><Space> :HopWord<cr>
" Zoom / Restore window. " Zoom / Restore window.
" https://stackoverflow.com/a/26551079 " https://stackoverflow.com/a/26551079
function! s:ZoomToggle() abort function! s:ZoomToggle() abort

View File

@ -30,7 +30,8 @@ set updatetime=300 " Faster diagnostics
set mouse=nv " Mouse interaction / scrolling set mouse=nv " Mouse interaction / scrolling
" Neovim only " 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 " Remember last position when reopening file
if has("autocmd") if has("autocmd")
@ -63,3 +64,9 @@ au BufRead,BufNewFile *ignore.*link setfiletype gitignore
au BufRead,BufNewFile gitconfig.*link setfiletype gitconfig au BufRead,BufNewFile gitconfig.*link setfiletype gitconfig
au BufRead,BufNewFile *.toml.*link setfiletype toml au BufRead,BufNewFile *.toml.*link setfiletype toml
au BufRead,BufNewFile .env* set ft=text | set syntax=sh 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

View File

@ -12,14 +12,18 @@ endif
call plug#begin('$HOME/.config/nvim/plugged') call plug#begin('$HOME/.config/nvim/plugged')
" Core plugins " Core plugins
Plug 'morhetz/gruvbox' " Colorscheme Plug 'nvim-lua/plenary.nvim' " Prerequisite library for other plugins
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } " Install fzf (required) Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } " Install fzf (prerequisite for fzf.vim)
Plug 'junegunn/fzf.vim' " Actual fuzzyfinder Plug 'junegunn/fzf.vim' " Actual fuzzyfinder
Plug 'morhetz/gruvbox' " Colorscheme
Plug 'tpope/vim-surround' " Enables paren editing Plug 'tpope/vim-surround' " Enables paren editing
Plug 'sheerun/vim-polyglot' " Syntax for every language 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 'tpope/vim-commentary' " Use gc or gcc to comment
Plug 'phaazon/hop.nvim' " Quick jump around the buffer 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 " Ancillary plugins
Plug 'godlygeek/tabular' " Spacing and alignment 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 'vimwiki/vimwiki' " Wiki Markdown System
Plug 'airblade/vim-rooter' " Change directory to git route Plug 'airblade/vim-rooter' " Change directory to git route
Plug 'tpope/vim-fugitive' " Other git commands Plug 'tpope/vim-fugitive' " Other git commands
Plug 'machakann/vim-highlightedyank' " Highlight text when copied
Plug 'itchyny/lightline.vim' " Status bar Plug 'itchyny/lightline.vim' " Status bar
Plug 'tpope/vim-eunuch' " File manipulation in Vim Plug 'tpope/vim-eunuch' " File manipulation in Vim
Plug 'tpope/vim-vinegar' " Fixes netrw file explorer Plug 'tpope/vim-vinegar' " Fixes netrw file explorer
Plug 'christoomey/vim-tmux-navigator' " Hotkeys for tmux panes 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() 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