Skip to content

Commit

Permalink
Merge pull request #8 from inkarkat/fix-softtabstops
Browse files Browse the repository at this point in the history
Fix softtabstop rendering
  • Loading branch information
thiagoalessio authored Dec 22, 2017
2 parents cc596eb + 4a339e9 commit 339056b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion autoload/rainbow_levels.vim
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@ func! rainbow_levels#match_level(level) abort
endfunc

func! rainbow_levels#get_pattern(level) abort
if rainbow_levels#is_indented_with_tabs()
if rainbow_levels#is_indented_with_softtabstop()
let l:size = a:level * rainbow_levels#get_indent_size()
let l:tab_level = l:size / &l:tabstop
let l:space_level = l:size % &l:tabstop

return '^\t\{'.l:tab_level.'} \{'.l:space_level.',}\S.*$'
elseif rainbow_levels#is_indented_with_tabs()
return '^\t\{'.a:level.'}\ *\S.*$'
else
let l:start = a:level * rainbow_levels#get_indent_size()
Expand All @@ -70,3 +76,7 @@ endfunc
func! rainbow_levels#is_indented_with_tabs() abort
return &l:shiftwidth <= 0 || !&l:expandtab
endfunc

func! rainbow_levels#is_indented_with_softtabstop() abort
return &l:softtabstop > 0 && !&l:expandtab
endfunc

0 comments on commit 339056b

Please sign in to comment.