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>
diff --git a/runtime/defaults.vim b/runtime/defaults.vim
index ff8ce8e..459841f 100644
--- a/runtime/defaults.vim
+++ b/runtime/defaults.vim
@@ -115,6 +115,11 @@
\ | 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