Respect shiftwidth if set by user or plugin

This commit is contained in:
Adam Stankiewicz
2020-10-23 01:30:33 +02:00
parent f828912a7f
commit 113f9b8949

View File

@@ -2638,6 +2638,8 @@ if !has_key(s:disabled_packages, 'autoindent')
let &tabstop = 2 let &tabstop = 2
endif endif
let s:default_shiftwidth = &shiftwidth
func! s:get_shiftwidth(indents) abort func! s:get_shiftwidth(indents) abort
let shiftwidth = 0 let shiftwidth = 0
let max_count = 0 let max_count = 0
@@ -2788,8 +2790,8 @@ if !has_key(s:disabled_packages, 'autoindent')
return return
endif endif
" Do not autodetect indent if language sets it " Do not autodetect indent if language or user sets it
if &l:shiftwidth != &g:shiftwidth if &l:shiftwidth != s:default_shiftwidth
return return
endif endif