runtime(defaults): Detect putty terminal and switch to dark background

Vim tries to determine the default background and checks for $TERM
and even checks for the "putty" value. But unfortunately, putty by
default uses "xterm" as $TERM value and as such Vim uses a "light"
background.

So use a TermResponse autocommand to set the background for putty back
to dark.

Note: this only works on non-tiny builds and when defaults.vim is in
use.

Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Christian Brabandt
2024-10-27 21:33:09 +01:00
parent ce35ee8986
commit 2abec431e1
4 changed files with 24 additions and 6 deletions

View File

@ -115,6 +115,11 @@ if 1
\ | execute "normal! g`\""
\ | endif
" Set the default background for putty to dark. Putty usually sets the
" $TERM to xterm and by default it starts with a dark background which
" makes syntax highlighting often hard to read with bg=light
" undo this using: ":au! vimStartup TermResponse"
autocmd TermResponse * if v:termresponse == "\e[>0;136;0c" | set bg=dark | endif
augroup END
" Quite a few people accidentally type "q:" instead of ":q" and get confused