Better Rust support in vim

This commit is contained in:
Cyryl Płotnicki 2018-05-27 23:51:05 +01:00
parent 29fb3756cd
commit 0efa7d2d8e
3 changed files with 51 additions and 3 deletions

View file

@ -1,5 +1,7 @@
call plug#end()
let g:deoplete#enable_at_startup = 1
" line ending
set fileformats=unix,dos
@ -28,7 +30,11 @@ endif
if executable('rg')
let g:ackprg = 'rg --no-heading --vimgrep'
set grepprg=rg\ --vimgrep
set grepprg=rg\ -i\ --vimgrep
" Ripgrep on /
command! -nargs=+ -complete=file -bar Rg silent! grep! <args>|cwindow|redraw!
nnoremap <leader>/ :Rg<SPACE>
endif
if executable('rls')
@ -40,8 +46,26 @@ if executable('rls')
endif
" fzf
command! -bang -nargs=* Find call fzf#vim#grep('rg --column --line-number --no-heading --fixed-strings --ignore-case --no-ignore --hidden --follow --color "always" '.shellescape(<q-args>).'| tr -d "\017"', 1, <bang>0)
nmap <C-n> :Find
if executable('rg')
let $FZF_DEFAULT_COMMAND = 'rg --files --no-messages "" .'
set grepprg=rg\ --vimgrep
endif
let g:fzf_command_prefix = 'Fzf'
if executable('fzf')
nnoremap <leader>v :FzfFiles<cr>
nnoremap <leader>u :FzfTags<cr>
nnoremap <leader>j :call fzf#vim#tags("'".expand('<cword>'))<cr>
if executable('rg')
" :Find <term> runs `rg <term>` and passes it to fzf
command! -bang -nargs=* Find call fzf#vim#grep('rg --column --line-number --no-heading --fixed-strings --ignore-case --no-ignore --hidden --follow --glob "!.git/*" --color "always" '.shellescape(<q-args>), 1, <bang>0)
nnoremap <leader>/ :Find
nnoremap <leader>' :execute "Find " . expand("<cword>")<cr>
endif
else
nnoremap <leader>v :CtrlP<Space><cr>
endif
" appearance
set number
@ -50,6 +74,23 @@ set laststatus=2
set noshowmode
set showtabline=1 "only show tabline when more than 1 tab
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
" syntastic
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_aggregate_errors = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_rust_checkers=['cargo']
" language server
let g:LanguageClient_autoStart = 1
let g:LanguageClient_serverCommands = { 'rust': ['rustup', 'run', 'nightly', 'rls'] }
" exclude quickfix from the buffers list
augroup qf
autocmd!

View file

@ -19,3 +19,8 @@ Plug 'prabirshrestha/async.vim'
Plug 'prabirshrestha/vim-lsp'
Plug 'prabirshrestha/asyncomplete.vim'
Plug 'prabirshrestha/asyncomplete-lsp.vim'
Plug 'Shougo/deoplete.nvim'
Plug 'roxma/nvim-yarp'
Plug 'roxma/vim-hug-neovim-rpc'
Plug 'vim-syntastic/syntastic'

View file

@ -205,6 +205,8 @@ if [[ -z $NOPYTHON3 ]]; then
set -e
echo "Installing Nikola"
$SUDO $PIP install --upgrade pygments-style-solarized ws4py watchdog webassets Nikola
echo "Installing vim dependencies"
$SUDO $PIP install neovim
fi
if [[ -z $USER ]]; then