diff options
-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 |