diff options
Diffstat (limited to 'ftdetect')
-rw-r--r-- | ftdetect/polyglot.vim | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index 938aac73..2ebfec95 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -2643,10 +2643,20 @@ if !has_key(s:disabled_packages, 'autoindent') func! s:get_shiftwidth(indents) abort let shiftwidth = 0 let max_count = 0 + let final_counts = {} for [indent, indent_count] in items(a:indents) - if indent_count > max_count + let indent_count *= 1.5 + for [indent2, indent2_count] in items(a:indents) + if indent2 > indent && indent2 % indent == 0 + let indent_count += indent2_count + endif + endfor + let final_counts[indent] = indent_count + endfor + for [indent, final_count] in items(final_counts) + if final_count > max_count let shiftwidth = indent - let max_count = indent_count + let max_count = final_count endif endfor return shiftwidth |