Skip to content

Commit 67f3020

Browse files
committed
Merge branch 'feature_showtab_switch' of https://github.com/amerlyq/vim-indent-guides into amerlyq-feature_showtab_switch
* 'feature_showtab_switch' of https://github.com/amerlyq/vim-indent-guides: Added symmetrical option to disable indents for tab
2 parents 705c5fd + 470ef5e commit 67f3020

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

autoload/indent_guides.vim

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,18 @@ function! indent_guides#enable()
4747
for l:level in range(s:start_level, s:indent_levels)
4848
let l:group = 'IndentGuides' . ((l:level % 2 == 0) ? 'Even' : 'Odd')
4949
let l:column_start = (l:level - 1) * s:indent_size + 1
50-
let l:soft_pattern = indent_guides#indent_highlight_pattern(g:indent_guides_soft_pattern, l:column_start, s:guide_size)
51-
let l:hard_pattern = indent_guides#indent_highlight_pattern('\t', l:column_start, s:indent_size)
5250

5351
" define the higlight patterns and add to matches list
5452
if g:indent_guides_space_guides
53+
let l:soft_pattern = indent_guides#indent_highlight_pattern(
54+
\ g:indent_guides_soft_pattern, l:column_start, s:guide_size)
5555
call add(w:indent_guides_matches, matchadd(l:group, l:soft_pattern))
5656
end
57-
call add(w:indent_guides_matches, matchadd(l:group, l:hard_pattern))
57+
if g:indent_guides_tab_guides
58+
let l:hard_pattern = indent_guides#indent_highlight_pattern(
59+
\ '\t', l:column_start, s:indent_size)
60+
call add(w:indent_guides_matches, matchadd(l:group, l:hard_pattern))
61+
end
5862
endfor
5963
endfunction
6064

doc/indent_guides.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,15 @@ Default: 1. Values: 0 or 1.
142142
let g:indent_guides_space_guides = 0
143143
<
144144

145+
------------------------------------------------------------------------------
146+
*'indent_guides_tab_guides'*
147+
Use this option to control whether the plugin considers tabs as indention.
148+
149+
Default: 1. Values: 0 or 1.
150+
>
151+
let g:indent_guides_tab_guides = 0
152+
153+
145154
------------------------------------------------------------------------------
146155
*'indent_guides_soft_pattern'*
147156
Use this option to explicitly specify a pattern for soft indentation. For

plugin/indent_guides.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ call s:InitVariable('g:indent_guides_start_level', 1)
5858
call s:InitVariable('g:indent_guides_enable_on_vim_startup', 0)
5959
call s:InitVariable('g:indent_guides_debug', 0)
6060
call s:InitVariable('g:indent_guides_space_guides', 1)
61+
call s:InitVariable('g:indent_guides_tab_guides', 1)
6162
call s:InitVariable('g:indent_guides_soft_pattern', '\s')
6263
call s:InitVariable('g:indent_guides_default_mapping', 1)
6364

0 commit comments

Comments
 (0)