Skip to content

Commit 113f9b8

Browse files
committed
Respect shiftwidth if set by user or plugin
1 parent f828912 commit 113f9b8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ftdetect/polyglot.vim

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2638,6 +2638,8 @@ if !has_key(s:disabled_packages, 'autoindent')
26382638
let &tabstop = 2
26392639
endif
26402640

2641+
let s:default_shiftwidth = &shiftwidth
2642+
26412643
func! s:get_shiftwidth(indents) abort
26422644
let shiftwidth = 0
26432645
let max_count = 0
@@ -2788,8 +2790,8 @@ if !has_key(s:disabled_packages, 'autoindent')
27882790
return
27892791
endif
27902792

2791-
" Do not autodetect indent if language sets it
2792-
if &l:shiftwidth != &g:shiftwidth
2793+
" Do not autodetect indent if language or user sets it
2794+
if &l:shiftwidth != s:default_shiftwidth
27932795
return
27942796
endif
27952797

0 commit comments

Comments
 (0)