From 88df3d0093d390b8408d074987d138b325fc00eb Mon Sep 17 00:00:00 2001 From: Matt Wozniski Date: Sat, 17 Jul 2010 20:48:53 -0400 Subject: [PATCH] Prevent CSApprox from trashing 'background' Whenever you change the Normal highlight group, vim always changes 'bg' to light; try: vim -u NONE -N -c 'set bg=dark' -c 'hi Normal ctermbg=16 ctermfg=255' This change just makes CSApprox save/restore 'bg' before/after changing the highlight groups. Suggestion made by Kris Malfettone (and I'm sure that someone else pointed this issue out to me in the past, but I didn't act on it then and forgot who you are, so I'm sorry for not crediting you). --- plugin/CSApprox.vim | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugin/CSApprox.vim b/plugin/CSApprox.vim index bfe3c89..54612d9 100644 --- a/plugin/CSApprox.vim +++ b/plugin/CSApprox.vim @@ -632,9 +632,13 @@ function! s:CSApprox(...) call s:HandleHooks("pre", (exists("colors_name") ? colors_name : "")) + let old_bg = &bg + " Set 'verbose' set to the maximum of &verbose and CSApprox_verbose_level exe max([&vbs, g:CSApprox_verbose_level]) 'verbose call s:CSApproxImpl()' + let &bg = old_bg + call s:HandleHooks("post", (exists("colors_name") ? colors_name : "")) finally if exists("colors_name") @@ -894,9 +898,7 @@ command! -bang -nargs=1 -complete=file -bar CSApproxSnapshot " {>2} Manual updates command -bang -bar CSApprox call s:CSApprox(strlen("")) -" {>1} Hooks - -" {>2} Autocmds +" {>1} Autocmds " Set up an autogroup to hook us on the completion of any :colorscheme command augroup CSApprox au!