From 51436e36776e9dbc3b7e4cfd0ae50e605054228f Mon Sep 17 00:00:00 2001 From: Nate Kane Date: Wed, 22 Dec 2010 21:44:46 +1000 Subject: [PATCH] Tweaked the indent_guides#cterm_highlight_colors() function --- autoload/indent_guides.vim | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/autoload/indent_guides.vim b/autoload/indent_guides.vim index 3ec756c..aef7b2c 100644 --- a/autoload/indent_guides.vim +++ b/autoload/indent_guides.vim @@ -90,15 +90,19 @@ 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_search = indent_guides#capture_highlight('Normal') + let hi_normal = indent_guides#capture_highlight('Normal') let ctermbg_pattern = "ctermbg=\\zs[0-9]\\+\\ze" - let hi_search_ctermbg = '' + let hi_normal_ctermbg = '' - " capture the background color from the search highlight - let hi_search_ctermbg = matchstr(hi_search, ctermbg_pattern) - exe 'hi IndentGuidesEven ctermbg=' . (hi_search_ctermbg + 1) - exe 'hi IndentGuidesOdd ctermbg=' . (hi_search_ctermbg + 2) + " 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) endfunction "