mirror of
https://github.com/nmasur/dotfiles
synced 2024-12-24 17:44:52 +00:00
switch to nvim-lspconfig
This commit is contained in:
parent
4f277c457f
commit
54f4062872
@ -1,7 +0,0 @@
|
||||
{
|
||||
"rust-analyzer.serverPath": "/usr/local/bin/rust-analyzer",
|
||||
"rust-analyzer.checkOnSave.enable": true,
|
||||
"diagnostic-languageserver.filetypes": {
|
||||
"sh": "shellcheck"
|
||||
}
|
||||
}
|
@ -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
|
||||
|
@ -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()
|
@ -72,6 +72,9 @@ nnoremap <Leader>wh :split<cr>
|
||||
" Close all other splits
|
||||
nnoremap <Leader>wm :only<cr>
|
||||
|
||||
" Jump around
|
||||
nnoremap <Leader><Space> :HopWord<cr>
|
||||
|
||||
" Zoom / Restore window.
|
||||
" https://stackoverflow.com/a/26551079
|
||||
function! s:ZoomToggle() abort
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user