Better rust support and changes all over

This commit is contained in:
Vladan Popovic 2021-01-05 20:46:52 +01:00
parent 4c95924618
commit 8017c2ac22

View file

@ -1,8 +1,6 @@
call plug#begin('~/.local/share/nvim/plugged') call plug#begin('~/.local/share/nvim/plugged')
Plug 'davidhalter/jedi-vim' Plug 'davidhalter/jedi-vim'
Plug 'Shougo/deoplete.nvim', {'do': ':UpdateRemotePlugins'}
Plug 'zchee/deoplete-jedi'
Plug 'ncm2/float-preview.nvim' Plug 'ncm2/float-preview.nvim'
Plug 'dense-analysis/ale' Plug 'dense-analysis/ale'
Plug 'jacoborus/tender.vim' Plug 'jacoborus/tender.vim'
@ -11,19 +9,19 @@ Plug 'vim-airline/vim-airline-themes'
Plug 'airblade/vim-gitgutter' Plug 'airblade/vim-gitgutter'
Plug 'scrooloose/nerdtree' Plug 'scrooloose/nerdtree'
Plug 'gleam-lang/gleam.vim' Plug 'gleam-lang/gleam.vim'
Plug 'cespare/vim-toml'
Plug 'rust-lang/rust.vim'
Plug 'vim-scripts/DrawIt'
call plug#end() call plug#end()
let g:airline_theme='base16_atelierlakeside' let g:airline_theme='papercolor'
let g:airline#extensions#ale#enabled=1 let g:airline#extensions#ale#enabled=1
let g:deoplete#enable_at_startup=1 inoremap <expr><tab> pumvisible() ? "\<C-n>" : "\<tab>"
" autocmd InsertLeave,CompleteDone * if pumvisible() == 0 | pclose | endif inoremap <expr><S-Tab> pumvisible() ? "\<C-p>" : "\<S-TAB>"
inoremap <expr><tab> pumvisible() ? "\<c-n>" : "\<tab>"
" disable autocompletion, cause we use deoplete for completion
let g:jedi#completions_enabled=0 let g:jedi#completions_enabled=0
" open the go-to function in split, not another buffer
let g:jedi#use_splits_not_buffers="right" let g:jedi#use_splits_not_buffers="right"
" Preview window is floating " Preview window is floating
@ -45,12 +43,13 @@ set completeopt-=preview
" Enable folding on indent " Enable folding on indent
set foldmethod=indent set foldmethod=indent
set foldlevel=79 set foldlevel=79
set omnifunc=ale#completion#OmniFunc
" Lint and check types " Lint and check types
let b:ale_linters={ let b:ale_linters={
\ 'python': ['mypy', 'pyls', 'pylint'], \ 'python': ['mypy', 'pyls', 'pylint'],
\ 'ocaml': ['merlin'], \ 'ocaml': ['merlin'],
\ 'rust': ['rls'] \ 'rust': ['analyzer', 'cargo']
\ } \ }
let b:ale_fixers = { let b:ale_fixers = {
\ 'rust': ['rustfmt'], \ 'rust': ['rustfmt'],
@ -58,9 +57,11 @@ let b:ale_fixers = {
\ 'ocaml': ['ocamlformat'] \ 'ocaml': ['ocamlformat']
\} \}
let g:ale_rust_rls_executable = 'rust-analyzer' let g:ale_rust_rustfmt_options='--edition 2018'
let g:ale_fix_on_save=1 let g:ale_fix_on_save=1
let g:ale_lint_on_save=1 let g:ale_lint_on_save=1
let g:ale_lint_on_enter=0
let g:ale_list_window_size=20 let g:ale_list_window_size=20
" Use .venv as a global default " Use .venv as a global default
let g:ale_virtualenv_dir_names=['.venv'] let g:ale_virtualenv_dir_names=['.venv']
@ -76,6 +77,8 @@ let b:ale_warn_about_trailing_whitespace=1
nmap <leader>e :ALEDetail<CR> nmap <leader>e :ALEDetail<CR>
noremap <leader>d :ALEGoToDefinition<CR> noremap <leader>d :ALEGoToDefinition<CR>
noremap g] :ALEGoToDefinition<CR>
noremap <leader>h :ALEHover<CR>
" ALE colors " ALE colors
highlight ALEError ctermbg=DarkRed ctermfg=Black highlight ALEError ctermbg=DarkRed ctermfg=Black
@ -100,8 +103,15 @@ highlight Folded ctermbg=Green ctermfg=Black
highlight Pmenu ctermbg=gray guibg=gray highlight Pmenu ctermbg=gray guibg=gray
highlight GitGutterAdd ctermfg=Green highlight GitGutterAdd ctermfg=Green
highlight GitGutterChange ctermfg=Yellow highlight GitGutterChange ctermfg=Red
highlight GitGutterDelete ctermfg=DarkRed highlight GitGutterDelete ctermfg=DarkRed
highlight GitGutterAddLine ctermbg=LightGreen
highlight GitGutterChangeLine ctermbg=Yellow
highlight GitGutterDeleteLine ctermbg=LightRed
highlight GitGutterChangeDeleteLine ctermbg=LightRed
nmap ]h <Plug>(GitGutterNextHunk)
nmap [h <Plug>(GitGutterPrevHunk)
let g:gitgutter_sign_added='+' let g:gitgutter_sign_added='+'
let g:gitgutter_sign_modified='±' let g:gitgutter_sign_modified='±'
@ -109,14 +119,15 @@ let g:gitgutter_sign_removed='-'
let g:gitgutter_sign_removed_first_line='^' let g:gitgutter_sign_removed_first_line='^'
let g:gitgutter_sign_modified_removed='-' let g:gitgutter_sign_modified_removed='-'
let g:gitgutter_map_keys=0 let g:gitgutter_map_keys=0
let g:gitgutter_set_sign_backgrounds=1
" Toggles on different plugins/modes " Toggles on different plugins/modes
noremap <F1> :ToggleMouse<CR> nmap <F1> :ToggleMouse<CR>
inoremap <F1> <Esc>:ToggleMouse<CR>a set pastetoggle=<F2>
nmap <F3> :set nonumber!<CR> nmap <F3> :set nonumber!<CR>
nmap <F4> :GitGutterBufferToggle<CR> nmap <F4> :GitGutterBufferToggle<CR>
nmap <F5> :NERDTreeToggle<CR> nmap <F5> :NERDTreeToggle<CR>
set pastetoggle=<F2> nmap <F6> :GitGutterLineHighlightsToggle<CR>
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab