nathanaelkane/vim-indent-guides — Issue #32: Setting default colors for Vim Terminal
Author: blodow
Created: 2012-01-31 11:43:03+00:00
State: open

Hi,

first off, great plugin! I just have one minor annoyance, I found it almost impossible to set custom indent colors when using vim in the console. The ``autocmd`` lines worked until I changed buffers, after which the colors were back to default.

So i basically overwrote ``indent_guides#basic_highlight_colors()`` in my ``.vimrc``, adding a default color option:

```
" set two dark grey colors for indent guides
let g:indent_guides_default_ctermbg_colors = [234, 235]

" function that registers / overrides "indent_guides#basic_highlight_colors"
function! OverrideIndentGuidesFunction ()
function! indent_guides#basic_highlight_colors()
if exists('g:indent_guides_default_ctermbg_colors')
let l:cterm_colors = g:indent_guides_default_ctermbg_colors
else
let l:cterm_colors = (&g:background == 'dark') ? ['darkgrey', 'black'] : ['lightgrey', 'white']
endif
let l:gui_colors = (&g:background == 'dark') ? ['grey15', 'grey30'] : ['grey70', 'grey85']

exe 'hi IndentGuidesEven guibg=' . l:gui_colors[0] . ' ctermbg=' . l:cterm_colors[0]
exe 'hi IndentGuidesOdd guibg=' . l:gui_colors[1] . ' ctermbg=' . l:cterm_colors[1]
endfunction
endfunction

" and a hook to overwrite the plugin's function with ours after the plugin has loaded:
autocmd VimEnter * :call OverrideIndentGuidesFunction()
```

This hack works, but I would appreciate it if some such option would be provided, such that the "fallback" to darkgrey etc. can be overriden by the user.