vim-indent-guides
vim-indent-guides copied to clipboard
Indent guides look ugly on 256-color terminal
While the automatic coloring of indent guides looks great in gvim, it looks really ugly running vim on a 256-color terminal. Compare and contrast, for example, these two screenshots:
The color scheme in both screenshots is zenburn, and the code snippet is from indent_guides.vim. The rest of the colors match quite well, which makes the indent guides stand out like a sore thumb.
When I check :hi IndentGuidesOdd
and :hi IndentGuidesEven
in gvim, I see that they've been calculated as grey85 and grey70 respectively. After a little playing around (the Xterm 256 color chart was a big help), I found that `:hi IndentGuidesOdd ctermbg=236and
:hi IndentGuidesEven ctermbg=240`` were decent matches for the guibg colors -- and indeed, when I set those values, my terminal VIm looks much better.
It would be nice if vim-indent-guides could detect a 256-color (or 88-color) terminal and calculate its grey values accordingly. The Python script at http://excess.org/article/2007/10/xterm-256-colour-chart-20/ might help: it shows that the greys in the Xterm 256 color chart are spread between 0xe8 (ctermbg=232) and 0xff (ctermbg=255), which means each increasing ctermbg number adds about 4% brightness overall. That should make the math reasonably simple for a 256-color terminal. (Afraid I can't help with the 88-color terminal math, as I don't have one of those handy to test with.)
Yeah, I'm having the same issue with the molokai theme
Yeah, so I have to give up this plugin, although it's really awesome.
Default terminal type on Mac OS is now xterm-256color in Terminal.
I've set as follows for a very dark theme on OS X, working well for me.
ctermbg=235 " IndentGuidesOdd ctermbg=237 " IndentGuidesEven
I'm using vim from Terminal on Mac OS X with whatever the default settings are. Not sure where these settings would go ?
Here are the relevant lines from my .vimrc. Mine is set specifically to turn on only for ruby files.
au FileType ruby IndentGuidesEnable
au FileType ruby let indent_guides_auto_colors = 0
au FileType ruby autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=darkgrey ctermbg=236
au FileType ruby autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=darkgrey ctermbg=237
au FileType ruby let indent_guides_color_change_percent = 10
au FileType ruby let indent_guides_guide_size = 1
indent_guides_color_change_percent has no effect in OS X terminal, but does in MacVim. This is why I've set the ctermbg explicitly.
It is important to set indent_guide_auto_colors
to 0. This fixed the problem for me.
let indent_guides_auto_colors = 0
let indent_guides_guide_size = 1
hi IndentGuidesOdd ctermbg=236
hi IndentGuidesEven ctermbg=237