diff options
author | Camil Staps | 2021-06-12 13:25:39 +0200 |
---|---|---|
committer | Camil Staps | 2021-06-12 13:25:39 +0200 |
commit | ba8a9c2a73ec758e6a67c4b929c80aafaebc4c06 (patch) | |
tree | 52ee8c359e3319ee83e08c801406304a8b4d2753 /vim | |
parent | Cleanup vimrc (diff) |
Add AutomaticBackground{En,Dis}able commands to vim
Diffstat (limited to 'vim')
-rw-r--r-- | vim/.vimrc | 24 |
1 files changed, 21 insertions, 3 deletions
@@ -115,14 +115,32 @@ endif map <LocalLeader>s :syn sync fromstart<CR> -autocmd BufEnter * set bg=dark | call s:set_terminal_line_border() -autocmd BufEnter *.bib,*.md,*.tex,*.txt set bg=light | call s:set_terminal_line_border() +function s:enable_automatic_background() + augroup bg + autocmd bg BufEnter * set bg=dark | call s:set_terminal_line_border() + autocmd bg BufEnter *.bib,*.md,*.tex,*.txt set bg=light | call s:set_terminal_line_border() + augroup END +endfunction + +function s:disable_automatic_background() + augroup bg + autocmd! bg + augroup END + augroup! bg +endfunction + +command AutomaticBackgroundEnable call s:enable_automatic_background() +command AutomaticBackgroundDisable call s:disable_automatic_background() + +call s:enable_automatic_background() " Setting the color scheme messes up the git gutter highlight groups, so reset " them. For some discussion, see: " - https://github.com/airblade/vim-gitgutter/issues/696 " - https://stackoverflow.com/a/7383051 -autocmd BufEnter * call s:reset_gitgutter_highlights() +augroup gitgutter + autocmd gitgutter BufEnter * call s:reset_gitgutter_highlights() +augroup END " Move through long lines as they were short multiple lines map <down> gj |