I recently discovered Vim colorschemes, and in the process have discovered a rather curious bug: when I run hi Normal ctermbg
in Vim, the color change carries over to the shell that I'm running Vim in, like so:
I'm using PuTTYtray (but also see the behavior in PuTTY) with 256 colors enabled , bolded text indicated by font changes, and $TERM set to "putty-256color"; my .vimrc is as follows:
set t_Co=256
colors zenburn
and zenburn.vim can be found here. I've isolated the problem specifically to specifically line 298, where it first configures ctermbg
for Normal highlighting.
(As an aside: it seems that when using PuTTY tray with specific color settings, in Normal highlighting, ctermbg
has to be first set simultaneously with guifg
or guibg
, e.g. hi Normal guifg=#dcdccc ctermbg=237
, and only after that will hi Normal ctermbg=some_val
work.)
Does anyone happen to have any idea why this is happening?
I've also tried to do a workaround by running hi Normal ctermbg=None
on VimLeave
(although I recognize that this is problematic if I run multiple Vim instances, so if anyone can suggest an alternative that would also be welcome), but with no success. Adding the following to my .vimrc
does not work:
function! RESET_ctermbg()
"reset $ctermbg to None"
exec "hi Normal ctermbg=None"
endfunction
au VimLeave * call RESET_ctermbg()
I've fixed the problem by changing $TERM
to xterm-256color
; my best bet is that putty-256color
is not well-supported enough as a shell to handle behavior like the vim colorscheme I was doing, so I don't even need to try to make the workaround work anymore.