summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2020-10-23 01:30:33 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2020-10-23 01:30:33 +0200
commit113f9b8949643f7e02c29051ad2148c3265b8131 (patch)
tree46d8e4bc8ede119134df7ca306282594bc9de3a0
parentf828912a7f39f7525fca1a90adeb390a53e0d0a1 (diff)
downloadvim-polyglot-113f9b8949643f7e02c29051ad2148c3265b8131.tar.gz
vim-polyglot-113f9b8949643f7e02c29051ad2148c3265b8131.zip
Respect shiftwidth if set by user or plugin
-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