Tweaked the indent_guides#cterm_highlight_colors() function so it works a bit more consistently
This commit is contained in:
parent
51436e3677
commit
b4b4ce9c76
@ -90,19 +90,14 @@ endfunction
|
|||||||
" Automagically calculates and defines the indent highlight colors for
|
" Automagically calculates and defines the indent highlight colors for
|
||||||
" terminal vim.
|
" 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()
|
function! indent_guides#cterm_highlight_colors()
|
||||||
let hi_normal = indent_guides#capture_highlight('Normal')
|
if &g:background == 'dark'
|
||||||
let ctermbg_pattern = "ctermbg=\\zs[0-9]\\+\\ze"
|
exe 'hi IndentGuidesEven ctermbg=darkgrey'
|
||||||
let hi_normal_ctermbg = ''
|
exe 'hi IndentGuidesOdd ctermbg=black'
|
||||||
|
else
|
||||||
" capture the background color from the normal highlight
|
exe 'hi IndentGuidesEven ctermbg=lightgrey'
|
||||||
let hi_normal_ctermbg = matchstr(hi_normal, ctermbg_pattern)
|
exe 'hi IndentGuidesOdd ctermbg=white'
|
||||||
exe 'hi IndentGuidesEven ctermbg=' . (hi_normal_ctermbg + 1)
|
endif
|
||||||
exe 'hi IndentGuidesOdd ctermbg=' . (hi_normal_ctermbg + 2)
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"
|
"
|
||||||
|
Loading…
Reference in New Issue
Block a user