summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ftdetect/polyglot.vim6
1 files changed, 4 insertions, 2 deletions
diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim
index 69d27f08..938aac73 100644
--- a/ftdetect/polyglot.vim
+++ b/ftdetect/polyglot.vim
@@ -2638,6 +2638,8 @@ if !has_key(s:disabled_packages, 'autoindent')
let &tabstop = 2
endif
+ let s:default_shiftwidth = &shiftwidth
+
func! s:get_shiftwidth(indents) abort
let shiftwidth = 0
let max_count = 0
@@ -2788,8 +2790,8 @@ if !has_key(s:disabled_packages, 'autoindent')
return
endif
- " Do not autodetect indent if language sets it
- if &l:shiftwidth != &g:shiftwidth
+ " Do not autodetect indent if language or user sets it
+ if &l:shiftwidth != s:default_shiftwidth
return
endif