Refresh Rust setup in vim

This commit is contained in:
Cyryl Płotnicki 2019-02-23 09:15:44 +00:00
parent 97644020df
commit deba5dcde9
3 changed files with 29 additions and 8 deletions

View file

@ -32,3 +32,20 @@ nnoremap <leader>' :execute "Find " . expand("<cword>")<cr>
" tree " tree
map <leader>n :NERDTreeToggle<CR> map <leader>n :NERDTreeToggle<CR>
" completion
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<cr>"
imap <c-space> <Plug>(asyncomplete_force_refresh)
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ asyncomplete#force_refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"

View file

@ -8,6 +8,7 @@ endif
call plug#begin('~/.vim/plugged') call plug#begin('~/.vim/plugged')
Plug 'airblade/vim-gitgutter' Plug 'airblade/vim-gitgutter'
Plug 'cespare/vim-toml'
Plug 'godlygeek/tabular' Plug 'godlygeek/tabular'
Plug 'https://github.com/cyplo/vim-colors-solarized.git' Plug 'https://github.com/cyplo/vim-colors-solarized.git'
Plug 'junegunn/fzf.vim' Plug 'junegunn/fzf.vim'

View file

@ -13,15 +13,18 @@ let g:fzf_command_prefix = '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) 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)
let g:ctrlp_show_hidden = 1 let g:ctrlp_show_hidden = 1
" register rust rls " code smarts - completion, navigation
if executable('rls') let g:asyncomplete_remove_duplicates = 1
au User lsp_setup call lsp#register_server({ let g:asyncomplete_smart_completion = 1
let g:asyncomplete_auto_popup = 1
au User lsp_setup call lsp#register_server({
\ 'name': 'rls', \ 'name': 'rls',
\ 'cmd': {server_info->['rustup', 'run', 'stable', 'rls']}, \ 'cmd': {server_info->['rustup', 'run', 'stable', 'rls']},
\ 'whitelist': ['rust'], \ 'whitelist': ['rust'],
\ }) \ })
endif
" nerdtree startup " nerdtree startup
autocmd StdinReadPre * let s:std_in=1 autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif