mirror of
https://git.decapod.one/brethil/dotfiles
synced 2024-11-22 11:31:30 +01:00
186 lines
5.6 KiB
VimL
186 lines
5.6 KiB
VimL
" colorscheme peaksea
|
||
colorscheme twilight256
|
||
|
||
let g:ale_set_balloons = 1
|
||
|
||
|
||
set mouse=a relativenumber number foldmethod=indent nofoldenable "without nofoldenable all folds are closed at startup"
|
||
set foldlevelstart=3
|
||
set ttymouse=xterm2 " fix mouse when used in tmux/byobu https://unix.stackexchange.com/q/50733
|
||
|
||
set splitbelow splitright
|
||
set autoread
|
||
set nowrap
|
||
|
||
" ALE configuration
|
||
let g:ale_fixers_aliases = {'vue': ['vue', 'javascript']}
|
||
|
||
let g:ale_fixers = {
|
||
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
|
||
\ 'bash': ['shfmt'],
|
||
\ 'json': ['prettier'],
|
||
\ 'cpp': ['clang-format'],
|
||
\ 'css': ['prettier'],
|
||
\ 'html': ['prettier'],
|
||
\ 'markdown': ['prettier'],
|
||
\ 'java': ['eclipselsp'],
|
||
\ 'yaml': ['prettier'],
|
||
\ 'python': ['black', 'isort'],
|
||
\ 'go': ['gofmt', "goimports"],
|
||
\ 'rust': ['rustfmt'],
|
||
\ "javascript": ["prettier", "eslint"],
|
||
\ "vue": ["prettier", "eslint"]
|
||
\}
|
||
|
||
let g:ale_python_bandit_options = "-c banditrc"
|
||
let g:ale_python_pylint_options = "--rcfile pylintrc --disable=W0511"
|
||
let g:ale_cpp_clang_options = '-std=c++17 -Wall -Wpedantic'
|
||
let g:ale_cpp_gcc_options = '-std=c++17 -Wall -Wpedantic'
|
||
let g:ale_cpp_cc_options = '-std=c++17 -Wall -Wpedantic'
|
||
|
||
|
||
let g:ale_linter_aliases = {'vue': ['vue', 'javascript']}
|
||
let g:ale_linters = {
|
||
\ 'bash': ['bashlint', "shellcheck"],
|
||
\ 'python': ['pyls', 'pylint', 'bandit', 'mypy'],
|
||
\ 'go': ['gopls', 'gobuild'],
|
||
\ 'rust': ['rustc'],
|
||
\ 'yaml': ['yamllint'],
|
||
\ 'javascript': ["yarn lint", "eslint", "vls"]
|
||
\}
|
||
|
||
let g:ack_default_options = " --cc --cpp --shell --python --html --js --vue"
|
||
let g:ale_completion_enabled = 1
|
||
let g:ale_completion_autoimport = 1
|
||
|
||
let g:ale_set_quickfix=1
|
||
let g:ale_set_loclist=0
|
||
" let g:ale_open_list = 1
|
||
" let g:ale_keep_list_window_open = 0
|
||
|
||
let g:ale_lint_on_save = 1
|
||
let g:ale_fix_on_save = 1
|
||
let g:ale_completion_enabled = 1
|
||
|
||
|
||
packadd termdebug
|
||
|
||
" Fix some gitgutter stuff
|
||
let g:gitgutter_enabled = 1
|
||
let g:gitgutter_override_sign_column_highlight = 0
|
||
highlight clear SignColumn
|
||
highlight GitGutterAdd ctermfg=2
|
||
highlight GitGutterChange ctermfg=3
|
||
highlight GitGutterDelete ctermfg=1
|
||
highlight GitGutterChangeDelete ctermfg=4
|
||
|
||
" Highlight all instances of word under cursor, when idle.
|
||
" Useful when studying strange source code.
|
||
" Type z/ to toggle highlighting on/off.
|
||
nnoremap z/ :if AutoHighlightToggle()<Bar>set hls<Bar>endif<CR>
|
||
function! AutoHighlightToggle()
|
||
let @/ = ''
|
||
if exists('#auto_highlight')
|
||
au! auto_highlight
|
||
augroup! auto_highlight
|
||
setl updatetime=4000
|
||
echo 'Highlight current word: off'
|
||
return 0
|
||
else
|
||
augroup auto_highlight
|
||
au!
|
||
au CursorHold * let @/ = '\V\<'.escape(expand('<cword>'), '\').'\>'
|
||
augroup end
|
||
setl updatetime=500
|
||
echo 'Highlight current word: ON'
|
||
return 1
|
||
endif
|
||
endfunction
|
||
|
||
" A friggin python breakpoint. Invoke with @b
|
||
let @b = 'A
|
||
breakpoint()<1B><>ajkj0'
|
||
|
||
let g:ctrlp_custom_ignore = {
|
||
\ 'dir': '\v(target|build|dist|.venv)$',
|
||
\ }
|
||
" \ 'file': '\v\.(exe|so|dll)$',
|
||
" \ 'link': 'some_bad_symbolic_links',
|
||
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard']
|
||
|
||
nnoremap <leader>mk :bel copen<bar>silent (cargo run) !<bar>redraw!<cr>
|
||
|
||
autocmd FileType yaml setlocal shiftwidth=2 softtabstop=2 expandtab
|
||
autocmd FileType yml setlocal shiftwidth=2 softtabstop=2 expandtab
|
||
|
||
function! GitStatus()
|
||
let [a,m,r] = GitGutterGetHunkSummary()
|
||
return printf('+%d ~%d -%d', a, m, r)
|
||
endfunction
|
||
set statusline+=%{GitStatus()}
|
||
|
||
" Improve vimdiff colors
|
||
highlight DiffAdd cterm=bold ctermfg=10 ctermbg=17 gui=none guifg=bg guibg=Red
|
||
highlight DiffDelete cterm=bold ctermfg=10 ctermbg=17 gui=none guifg=bg guibg=Red
|
||
highlight DiffChange cterm=bold ctermfg=10 ctermbg=17 gui=none guifg=bg guibg=Red
|
||
highlight DiffText cterm=bold ctermfg=10 ctermbg=88 gui=none guifg=bg guibg=Red
|
||
|
||
|
||
function! WinZoomToggle() abort
|
||
if ! exists('w:WinZoomIsZoomed')
|
||
let w:WinZoomIsZoomed = 0
|
||
endif
|
||
if w:WinZoomIsZoomed == 0
|
||
let w:WinZoomOldWidth = winwidth(0)
|
||
let w:WinZoomOldHeight = winheight(0)
|
||
wincmd _
|
||
wincmd |
|
||
let w:WinZoomIsZoomed = 1
|
||
elseif w:WinZoomIsZoomed == 1
|
||
execute "resize " . w:WinZoomOldHeight
|
||
execute "vertical resize " . w:WinZoomOldWidth
|
||
let w:WinZoomIsZoomed = 0
|
||
endif
|
||
endfunction
|
||
|
||
nnoremap <leader>wz :call WinZoomToggle()<CR>
|
||
|
||
nnoremap <leader>/ :G<CR>
|
||
nnoremap <leader>C :close<CR>
|
||
nnoremap <leader>B :Bclose<CR>
|
||
nnoremap <leader>k :Ack
|
||
nnoremap <leader>g :Git<CR>
|
||
nnoremap <leader>gd :Git diff<CR>
|
||
nnoremap <leader>gp :Git push<CR>
|
||
nnoremap <leader>gpf :Git push --force-with-lease<CR>
|
||
nnoremap <leader>M :Git commit<CR>
|
||
nnoremap <leader>u :GitGutterBufferToggle<CR>
|
||
nnoremap <leader>L :GitGutterLineHighlightsToggle<CR>
|
||
|
||
" OR map keys to use wrapping.
|
||
nmap <silent> <C-k> <Plug>(ale_previous_wrap)
|
||
nmap <silent> <C-j> <Plug>(ale_next_wrap)
|
||
|
||
" this is assigned to jedi#goto_stubs()
|
||
" nunmap <leader>s
|
||
|
||
" nnoremap <leader>sv :ALEGoToTypeDefinitionInVSplit<CR>
|
||
" nnoremap <leader>sh :ALEGoToTypeDefinitionInSplit<CR>
|
||
" nnoremap <leader>st :ALEGoToTypeDefinitionInTab<CR>
|
||
" nnoremap <leader> :ALEGoToTypeDefinition<CR>
|
||
nmap <leader>sv :ALEGoToDefinition -vsplit<CR>
|
||
nmap <leader>sh :ALEGoToDefinition -split<CR>
|
||
nmap <leader>st :ALEGoToDefinition -tab<CR>
|
||
nmap <leader>A :ALEGoToDefinition<CR>
|
||
nmap <leader>n :ALEFindReferences<CR>
|
||
nmap <leader>n :ALEFindReferences<CR>
|
||
nmap <leader>h :ALEHover<CR>
|
||
nmap <leader>r :ALERename<CR>
|
||
|
||
nmap <leader>t :CtrlPTag<CR>
|
||
|
||
" Add shortcuts to yank/paste to unnamed/unnamedplus clipboards
|
||
noremap <Leader>y "*y
|
||
noremap <Leader>p "*p
|
||
noremap <Leader>Y "+y
|
||
noremap <Leader>P "+p
|