Skip to content
This repository
Browse code

Tweaked the indent_guides#cterm_highlight_colors() function

  • Loading branch information...
commit 51436e36776e9dbc3b7e4cfd0ae50e605054228f 1 parent b365670
Nate Kane authored

Showing 1 changed file with 10 additions and 6 deletions. Show diff stats Hide diff stats

  1. +10 6 autoload/indent_guides.vim
16 autoload/indent_guides.vim
@@ -90,15 +90,19 @@ endfunction
90 90 " Automagically calculates and defines the indent highlight colors for
91 91 " terminal vim.
92 92 "
  93 +" NOTE: At the moment this function only supports color numbers and not names.
  94 +" For example, `:hi Normal` containing `ctermbg=0` will work, but
  95 +" `ctermbg=DarkGrey` will not.
  96 +"
93 97 function! indent_guides#cterm_highlight_colors()
94   - let hi_search = indent_guides#capture_highlight('Normal')
  98 + let hi_normal = indent_guides#capture_highlight('Normal')
95 99 let ctermbg_pattern = "ctermbg=\\zs[0-9]\\+\\ze"
96   - let hi_search_ctermbg = ''
  100 + let hi_normal_ctermbg = ''
97 101
98   - " capture the background color from the search highlight
99   - let hi_search_ctermbg = matchstr(hi_search, ctermbg_pattern)
100   - exe 'hi IndentGuidesEven ctermbg=' . (hi_search_ctermbg + 1)
101   - exe 'hi IndentGuidesOdd ctermbg=' . (hi_search_ctermbg + 2)
  102 + " capture the background color from the normal highlight
  103 + let hi_normal_ctermbg = matchstr(hi_normal, ctermbg_pattern)
  104 + exe 'hi IndentGuidesEven ctermbg=' . (hi_normal_ctermbg + 1)
  105 + exe 'hi IndentGuidesOdd ctermbg=' . (hi_normal_ctermbg + 2)
102 106 endfunction
103 107
104 108 "

0 comments on commit 51436e3

Please sign in to comment.
Something went wrong with that request. Please try again.