2020-07-15 10:24:30 +02:00
|
|
|
call plug#begin('~/.local/share/nvim/plugged')
|
|
|
|
|
|
|
|
Plug 'davidhalter/jedi-vim'
|
2020-12-24 17:25:37 +01:00
|
|
|
Plug 'ncm2/float-preview.nvim'
|
2020-07-15 10:24:30 +02:00
|
|
|
Plug 'dense-analysis/ale'
|
|
|
|
Plug 'jacoborus/tender.vim'
|
|
|
|
Plug 'vim-airline/vim-airline'
|
2020-12-24 17:25:37 +01:00
|
|
|
Plug 'vim-airline/vim-airline-themes'
|
2020-07-15 10:24:30 +02:00
|
|
|
Plug 'airblade/vim-gitgutter'
|
|
|
|
Plug 'scrooloose/nerdtree'
|
2020-12-24 17:25:37 +01:00
|
|
|
Plug 'gleam-lang/gleam.vim'
|
2021-01-05 20:46:52 +01:00
|
|
|
Plug 'cespare/vim-toml'
|
|
|
|
Plug 'rust-lang/rust.vim'
|
|
|
|
Plug 'vim-scripts/DrawIt'
|
2020-07-15 10:24:30 +02:00
|
|
|
|
|
|
|
call plug#end()
|
|
|
|
|
2021-01-05 20:46:52 +01:00
|
|
|
let g:airline_theme='papercolor'
|
2020-12-24 17:25:37 +01:00
|
|
|
let g:airline#extensions#ale#enabled=1
|
|
|
|
|
2021-01-05 20:46:52 +01:00
|
|
|
inoremap <expr><tab> pumvisible() ? "\<C-n>" : "\<tab>"
|
|
|
|
inoremap <expr><S-Tab> pumvisible() ? "\<C-p>" : "\<S-TAB>"
|
2020-07-15 10:24:30 +02:00
|
|
|
|
|
|
|
let g:jedi#completions_enabled=0
|
|
|
|
let g:jedi#use_splits_not_buffers="right"
|
|
|
|
|
2020-12-24 17:25:37 +01:00
|
|
|
" Preview window is floating
|
|
|
|
let g:float_preview#docked=0
|
|
|
|
let g:float_preview#max_width=100
|
|
|
|
let g:float_preview#max_height=150
|
|
|
|
let g:float_preview#auto_close=0
|
2020-07-15 10:24:30 +02:00
|
|
|
|
|
|
|
set tabstop=4
|
|
|
|
set softtabstop=4
|
|
|
|
set shiftwidth=4
|
|
|
|
set textwidth=79
|
|
|
|
set expandtab
|
|
|
|
set autoindent
|
|
|
|
set fileformat=unix
|
|
|
|
set number
|
2020-12-24 17:25:37 +01:00
|
|
|
" Hide top preview window, use float_preview instead
|
|
|
|
set completeopt-=preview
|
2020-07-15 10:24:30 +02:00
|
|
|
" Enable folding on indent
|
|
|
|
set foldmethod=indent
|
|
|
|
set foldlevel=79
|
2021-01-05 20:46:52 +01:00
|
|
|
set omnifunc=ale#completion#OmniFunc
|
2020-07-15 10:24:30 +02:00
|
|
|
|
|
|
|
" Lint and check types
|
2020-12-24 17:25:37 +01:00
|
|
|
let b:ale_linters={
|
|
|
|
\ 'python': ['mypy', 'pyls', 'pylint'],
|
|
|
|
\ 'ocaml': ['merlin'],
|
2021-01-05 20:46:52 +01:00
|
|
|
\ 'rust': ['analyzer', 'cargo']
|
2020-12-24 17:25:37 +01:00
|
|
|
\ }
|
|
|
|
let b:ale_fixers = {
|
|
|
|
\ 'rust': ['rustfmt'],
|
|
|
|
\ 'python': ['autopep8'],
|
|
|
|
\ 'ocaml': ['ocamlformat']
|
|
|
|
\}
|
|
|
|
|
2021-01-05 20:46:52 +01:00
|
|
|
let g:ale_rust_rustfmt_options='--edition 2018'
|
|
|
|
|
2020-12-24 17:25:37 +01:00
|
|
|
let g:ale_fix_on_save=1
|
2020-07-15 10:24:30 +02:00
|
|
|
let g:ale_lint_on_save=1
|
2021-01-05 20:46:52 +01:00
|
|
|
let g:ale_lint_on_enter=0
|
2020-07-15 10:24:30 +02:00
|
|
|
let g:ale_list_window_size=20
|
|
|
|
" Use .venv as a global default
|
|
|
|
let g:ale_virtualenv_dir_names=['.venv']
|
|
|
|
let g:ale_completion_enabled=1
|
|
|
|
let g:ale_sign_error="✗"
|
|
|
|
let g:ale_sign_warning="⚠"
|
2020-12-24 17:25:37 +01:00
|
|
|
let g:ale_echo_msg_error_str = 'E'
|
|
|
|
let g:ale_echo_msg_warning_str = 'W'
|
|
|
|
let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
|
2020-07-15 10:24:30 +02:00
|
|
|
|
|
|
|
" Enable warnings about trailing whitespace for all files.
|
|
|
|
let b:ale_warn_about_trailing_whitespace=1
|
|
|
|
|
2020-12-24 17:25:37 +01:00
|
|
|
nmap <leader>e :ALEDetail<CR>
|
|
|
|
noremap <leader>d :ALEGoToDefinition<CR>
|
2021-01-05 20:46:52 +01:00
|
|
|
noremap g] :ALEGoToDefinition<CR>
|
|
|
|
noremap <leader>h :ALEHover<CR>
|
2020-07-15 10:24:30 +02:00
|
|
|
|
|
|
|
" ALE colors
|
2020-12-24 17:25:37 +01:00
|
|
|
highlight ALEError ctermbg=DarkRed ctermfg=Black
|
|
|
|
highlight ALEWarning ctermbg=Yellow ctermfg=White
|
2020-07-15 10:24:30 +02:00
|
|
|
|
|
|
|
" Use TAB to switch between buffers
|
2020-07-24 10:46:44 +02:00
|
|
|
noremap <tab> :bn<CR>
|
|
|
|
noremap <S-tab> :bp<CR>
|
2020-07-15 10:24:30 +02:00
|
|
|
|
|
|
|
" Highlight trailing whitespace (darker red) and remove all with Ctrl+k
|
|
|
|
highlight WhitespaceEOL ctermbg=red guibg=#ab0d0d
|
|
|
|
match WhitespaceEOL /\s\+\%#\@<!$/
|
|
|
|
nnoremap <C-k> :let _s=@/<Bar>:%s/\s\+$//e<Bar>:let @/=_s<Bar><CR>
|
|
|
|
|
|
|
|
" Much better with Tomorrow Night Bright color theme set in alacritty
|
2020-12-24 17:25:37 +01:00
|
|
|
" set background=dark
|
2020-07-15 10:24:30 +02:00
|
|
|
highlight Search ctermfg=Black
|
|
|
|
highlight Comment ctermfg=Grey
|
2020-12-24 17:25:37 +01:00
|
|
|
highlight SignColumn ctermbg=0
|
|
|
|
highlight LineNr ctermbg=0 ctermfg=248
|
|
|
|
highlight Folded ctermbg=Green ctermfg=Black
|
|
|
|
highlight Pmenu ctermbg=gray guibg=gray
|
2020-07-15 10:24:30 +02:00
|
|
|
|
2020-12-24 17:25:37 +01:00
|
|
|
highlight GitGutterAdd ctermfg=Green
|
2021-01-05 20:46:52 +01:00
|
|
|
highlight GitGutterChange ctermfg=Red
|
2020-12-24 17:25:37 +01:00
|
|
|
highlight GitGutterDelete ctermfg=DarkRed
|
2021-01-05 20:46:52 +01:00
|
|
|
highlight GitGutterAddLine ctermbg=LightGreen
|
|
|
|
highlight GitGutterChangeLine ctermbg=Yellow
|
|
|
|
highlight GitGutterDeleteLine ctermbg=LightRed
|
|
|
|
highlight GitGutterChangeDeleteLine ctermbg=LightRed
|
|
|
|
|
|
|
|
nmap ]h <Plug>(GitGutterNextHunk)
|
|
|
|
nmap [h <Plug>(GitGutterPrevHunk)
|
2020-07-15 10:24:30 +02:00
|
|
|
|
|
|
|
let g:gitgutter_sign_added='+'
|
2020-12-24 17:25:37 +01:00
|
|
|
let g:gitgutter_sign_modified='±'
|
2020-07-15 10:24:30 +02:00
|
|
|
let g:gitgutter_sign_removed='-'
|
2020-12-24 17:25:37 +01:00
|
|
|
let g:gitgutter_sign_removed_first_line='^'
|
|
|
|
let g:gitgutter_sign_modified_removed='-'
|
2020-07-15 10:24:30 +02:00
|
|
|
let g:gitgutter_map_keys=0
|
2021-01-05 20:46:52 +01:00
|
|
|
let g:gitgutter_set_sign_backgrounds=1
|
2020-07-15 10:24:30 +02:00
|
|
|
|
|
|
|
" Toggles on different plugins/modes
|
2021-01-05 20:46:52 +01:00
|
|
|
nmap <F1> :ToggleMouse<CR>
|
|
|
|
set pastetoggle=<F2>
|
2020-07-24 10:46:44 +02:00
|
|
|
nmap <F3> :set nonumber!<CR>
|
|
|
|
nmap <F4> :GitGutterBufferToggle<CR>
|
|
|
|
nmap <F5> :NERDTreeToggle<CR>
|
2021-01-05 20:46:52 +01:00
|
|
|
nmap <F6> :GitGutterLineHighlightsToggle<CR>
|
2020-07-15 10:24:30 +02:00
|
|
|
|
2020-12-24 17:25:37 +01:00
|
|
|
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
|
|
|
|
|
2020-07-15 10:24:30 +02:00
|
|
|
" Maintain undo history between sessions
|
2020-12-24 17:25:37 +01:00
|
|
|
if !isdirectory("/tmp/.vim-undo-dir-vladan")
|
|
|
|
call mkdir("/tmp/.vim-undo-dir-vladan", "", 0700)
|
2020-07-15 10:24:30 +02:00
|
|
|
endif
|
2020-12-24 17:25:37 +01:00
|
|
|
set undodir=/tmp/.vim-undo-dir-vladan
|
2020-07-15 10:24:30 +02:00
|
|
|
set undofile
|
2020-12-24 17:25:37 +01:00
|
|
|
" Enable vimrc files per project
|
|
|
|
set exrc
|
|
|
|
" Disable unsafe commands in project vimrc
|
|
|
|
set secure
|