Skip to content

Commit

Permalink
Correctly match levels with tabs+spaces (fixes #6)
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagoalessio committed Dec 21, 2017
1 parent 367e974 commit 5fafcb0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions autoload/rainbow_levels.vim
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ endfunc

func! rainbow_levels#get_pattern(level) abort
if rainbow_levels#is_indented_with_tabs()
return '^\t\{'.a:level.'}\S.*$'
return '^\t\{'.a:level.'}\ *\S.*$'
else
let l:start = a:level * rainbow_levels#get_indent_size()
let l:end = l:start + rainbow_levels#get_indent_size() - 1
Expand All @@ -61,7 +61,10 @@ func! rainbow_levels#get_pattern(level) abort
endfunc

func! rainbow_levels#get_indent_size() abort
return rainbow_levels#is_indented_with_tabs() ? &l:tabstop : &l:shiftwidth
if rainbow_levels#is_indented_with_tabs()
return &l:softtabstop ? &l:softtabstop : &l:tabstop
endif
return &l:shiftwidth
endfunc

func! rainbow_levels#is_indented_with_tabs() abort
Expand Down

0 comments on commit 5fafcb0

Please sign in to comment.