summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2020-10-19 11:24:31 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2020-10-19 11:24:31 +0200
commitb64fcedd82f188e7951585c6dda5efc5f4a497b2 (patch)
tree870e647d8fc299f5a3b960f32906e687b01e7d3c
parent903793ac04b9fbc06f3e0b6e63113a0dd4c87940 (diff)
downloadvim-polyglot-b64fcedd82f188e7951585c6dda5efc5f4a497b2.tar.gz
vim-polyglot-b64fcedd82f188e7951585c6dda5efc5f4a497b2.zip
Count only increments in indent, also respect ftplugin settings
-rw-r--r--ftdetect/polyglot.vim13
1 files changed, 4 insertions, 9 deletions
diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim
index 69934c48..83198ebc 100644
--- a/ftdetect/polyglot.vim
+++ b/ftdetect/polyglot.vim
@@ -2733,7 +2733,7 @@ if !has_key(s:disabled_packages, 'autoindent')
else
let spaces_minus_tabs += 1
let indent = len(matchstr(line, '^ *'))
- let indent_inc = abs(indent - prev_indent)
+ let indent_inc = indent - prev_indent
if indent_inc > 0 && lineno == next_indent_lineno
if has_key(indents, indent_inc)
@@ -2771,14 +2771,9 @@ if !has_key(s:disabled_packages, 'autoindent')
return
endif
- if &expandtab
- " Make tabstop to be synchronized with shiftwidth by default
- " Some plugins are using &shiftwidth directly or accessing &tabstop
- if &tabstop != 8 || &shiftwidth == 0
- let &shiftwidth = &tabstop
- else
- let &tabstop = &shiftwidth
- endif
+ " Do not autodetect indent if language sets it
+ if &l:shiftwidth != &g:shiftwidth
+ return
endif
let b:sleuth_culprit = expand("<afile>:p")