Permalink
Browse files

Tweaked the indent_guides#cterm_highlight_colors() function so it wor…

…ks a bit more consistently
  • Loading branch information...
1 parent 51436e3 commit b4b4ce9c7685c157c7afe8395087885fe260fc89 Nate Kane committed Dec 29, 2010
Showing with 7 additions and 12 deletions.
  1. +7 −12 autoload/indent_guides.vim
View
@@ -90,19 +90,14 @@ endfunction
" Automagically calculates and defines the indent highlight colors for
" terminal vim.
"
-" NOTE: At the moment this function only supports color numbers and not names.
-" For example, `:hi Normal` containing `ctermbg=0` will work, but
-" `ctermbg=DarkGrey` will not.
-"
function! indent_guides#cterm_highlight_colors()
- let hi_normal = indent_guides#capture_highlight('Normal')
- let ctermbg_pattern = "ctermbg=\\zs[0-9]\\+\\ze"
- let hi_normal_ctermbg = ''
-
- " capture the background color from the normal highlight
- let hi_normal_ctermbg = matchstr(hi_normal, ctermbg_pattern)
- exe 'hi IndentGuidesEven ctermbg=' . (hi_normal_ctermbg + 1)
- exe 'hi IndentGuidesOdd ctermbg=' . (hi_normal_ctermbg + 2)
+ if &g:background == 'dark'
+ exe 'hi IndentGuidesEven ctermbg=darkgrey'
+ exe 'hi IndentGuidesOdd ctermbg=black'
+ else
+ exe 'hi IndentGuidesEven ctermbg=lightgrey'
+ exe 'hi IndentGuidesOdd ctermbg=white'
+ endif
endfunction
"

0 comments on commit b4b4ce9

Please sign in to comment.