mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-08 11:33:52 -05:00
Count all multiplies for given indent, fixes #592
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user