Skip to content

Commit 018298e

Browse files
committed
Merge branch 'amerlyq-feature_showtab_switch'
* amerlyq-feature_showtab_switch: Update help file Formatting Added symmetrical option to disable indents for tab
2 parents 705c5fd + 930eba1 commit 018298e

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

autoload/indent_guides.vim

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,16 @@ 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(g:indent_guides_soft_pattern, l:column_start, s:guide_size)
5554
call add(w:indent_guides_matches, matchadd(l:group, l:soft_pattern))
5655
end
57-
call add(w:indent_guides_matches, matchadd(l:group, l:hard_pattern))
56+
if g:indent_guides_tab_guides
57+
let l:hard_pattern = indent_guides#indent_highlight_pattern('\t', l:column_start, s:indent_size)
58+
call add(w:indent_guides_matches, matchadd(l:group, l:hard_pattern))
59+
end
5860
endfor
5961
endfunction
6062

doc/indent_guides.txt

Lines changed: 11 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
@@ -263,6 +272,8 @@ Bug reports, feedback, suggestions etc are welcomed.
263272
* Set size of indent guide to `tabstop` value when `shiftwidth=0` or
264273
`noexpandtab` is used (thanks @darkfeline and @wilywampa).
265274
* Don't load plugin in unsupported versions of Vim (thanks @dersaidin).
275+
* Added option g:|indent_guides_tab_guides| to control whether tabs are
276+
considered as indention (thanks @amerlyq).
266277

267278
1.7~
268279
* Added way to override the default mapping (thanks @xuhdev).

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)