Tweaked highlight patterns.
This commit is contained in:
parent
73703c93ad
commit
7af506c797
@ -41,12 +41,20 @@ function! indent_guides#enable()
|
||||
" will automagically figure out whether to use tabs or spaces
|
||||
for l:level in range(s:start_level, s:indent_levels)
|
||||
let l:group = 'IndentGuides' . ((l:level % 2 == 0) ? 'Even' : 'Odd')
|
||||
let l:pattern = '^\s*\%' . ((l:level - 1) * s:indent_size + 1) . 'v\zs'
|
||||
let l:pattern .= '\s*\%' . (((l:level - 1) * s:indent_size + 1) + s:guide_size) . 'v'
|
||||
let l:pattern .= '\ze'
|
||||
|
||||
" soft-tab pattern
|
||||
let l:soft_pattern = '^\s*\%' . ((l:level - 1) * s:indent_size + 1) . 'v\zs'
|
||||
let l:soft_pattern .= '\s*\%' . (((l:level - 1) * s:indent_size + 1) + s:guide_size) . 'v'
|
||||
let l:soft_pattern .= '\ze'
|
||||
|
||||
" hard-tab pattern
|
||||
let l:hard_pattern = '^\t*\%' . ((l:level - 1) * s:indent_size + 1) . 'v\zs'
|
||||
let l:hard_pattern .= '\t*\%' . (((l:level - 1) * s:indent_size + 1) + s:indent_size) . 'v'
|
||||
let l:hard_pattern .= '\ze'
|
||||
|
||||
" define the higlight pattern and add to list
|
||||
call add(w:indent_guides_matches, matchadd(l:group, l:pattern))
|
||||
call add(w:indent_guides_matches, matchadd(l:group, l:soft_pattern))
|
||||
call add(w:indent_guides_matches, matchadd(l:group, l:hard_pattern))
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
@ -208,16 +216,8 @@ endfunction
|
||||
function! indent_guides#calculate_guide_size()
|
||||
let l:guide_size = g:indent_guides_guide_size
|
||||
|
||||
if &expandtab == 0 && &tabstop == s:indent_size
|
||||
let l:guide_size = s:indent_size
|
||||
else
|
||||
if s:indent_size > 1 && l:guide_size >= 1
|
||||
if l:guide_size > s:indent_size
|
||||
let l:guide_size = s:indent_size
|
||||
end
|
||||
else
|
||||
let l:guide_size = s:indent_size
|
||||
endif
|
||||
endif
|
||||
|
||||
return l:guide_size
|
||||
|
Loading…
Reference in New Issue
Block a user