dotfiles/my_configs.vim

132 lines
3.8 KiB
VimL
Raw Normal View History

2020-02-14 16:35:43 +01:00
python3 from powerline.vim import setup as powerline_setup
python3 powerline_setup()
python3 del powerline_setup
let g:Powerline_symbols = 'fancy'
2020-02-14 16:37:50 +01:00
colorscheme twilight256
2020-02-14 16:35:43 +01:00
" colorscheme solarized
2020-02-14 16:37:46 +01:00
set mouse=a relativenumber number foldmethod=indent nofoldenable "without nofoldenable all folds are closed at startup"
set splitbelow splitright
set autoread
2020-02-14 16:35:43 +01:00
set nowrap
set showtabline=2 laststatus=2 " fix statusline
" ALE configuration
let g:ale_fixers_aliases = {'vue': ['vue', 'javascript']}
let g:ale_fixers = {
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
\ 'python': ['black'],
\ 'rust': ['rustfmt'],
\ "javascript": ["prettier", "eslint"],
\ "vue": ["prettier", "eslint"]
\}
let g:ale_linter_aliases = {'vue': ['vue', 'javascript']}
let g:ale_linters = {
\ 'python': ['pylint'],
\ 'bash': ['bashlint', "shellcheck"],
\ 'rust': ['rustc'],
\ 'yaml': ['yamllint'],
\ 'javascript': ["eslint", "vls"],
\}
let g:ale_lint_on_insert_leave = 1
let g:ale_fix_on_insert_leave = 1
2020-02-14 16:37:51 +01:00
let g:ale_lint_on_text_changed = 1
2020-02-14 16:35:43 +01:00
let g:ack_default_options = " --cc --cpp --shell --python --html --js"
let g:ale_set_quickfix=1
let g:ale_set_loclist=0
2020-02-14 16:37:49 +01:00
" let g:ale_lint_on_save = 1
let g:ale_fix_on_save = 1
let g:ale_lint_on_insert_leave = 1
let g:ale_completion_enabled = 1
2020-02-14 16:37:46 +01:00
packadd termdebug
2020-02-14 16:37:50 +01:00
2020-02-14 16:35:43 +01:00
" Fix some gitgutter stuff
2020-02-14 16:37:50 +01:00
let g:gitgutter_enabled = 1
2020-02-14 16:35:43 +01:00
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
2020-02-14 16:37:50 +01:00
2020-02-14 16:37:50 +01:00
" 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'
2019-12-27 01:24:53 +01:00
let g:ctrlp_custom_ignore = {
2020-02-14 16:35:43 +01:00
\ 'dir': '\v(target|build|dist)$',
2019-12-27 01:24:53 +01:00
\ }
" \ 'file': '\v\.(exe|so|dll)$',
" \ 'link': 'some_bad_symbolic_links',
2020-02-09 14:37:18 +01:00
nnoremap <leader>mk :bel copen<bar>silent (cargo run) !<bar>redraw!<cr>
2020-02-14 16:35:43 +01:00
autocmd FileType yaml setlocal shiftwidth=2 softtabstop=2 expandtab
2020-03-09 17:57:37 +01:00
autocmd FileType yml setlocal shiftwidth=2 softtabstop=2 expandtab
2020-02-14 16:35:43 +01:00
function! GitStatus()
let [a,m,r] = GitGutterGetHunkSummary()
return printf('+%d ~%d -%d', a, m, r)
endfunction
set statusline+=%{GitStatus()}
2020-03-09 17:57:23 +01:00
" 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
2020-03-09 17:58:07 +01:00
" let g:ctrlp_custom_ignore = {
" \ 'file': '\v\.(pdf|csv|gz|csv)$',
" \ 'dir': '(dist|build)$',
" \ }
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard']
2020-03-09 17:58:39 +01:00
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>