You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If noet is enabled and I try to use multiline function parameters indention counts characters without expanding tabs to shiftwidth. I made an quick local fix but I'm not exactly sure if that is completely correct.
diff --git a/after/indent/lua.vim b/after/indent/lua.vim
index 5f18744..4c32d8e 100755
--- a/after/indent/lua.vim
+++ b/after/indent/lua.vim
@@ -216,6 +216,18 @@ function! LuaGetPrevLines()
return s:GetPrevLines()
endfunction
+function s:GetIndentWidth(line, end_idx)
+ let result = 0
+ for pos in range(a:end_idx)
+ if a:line[pos] == "\t"
+ let result += &shiftwidth
+ else
+ let result += 1
+ endif
+ endfor
+ return result
+endfunction
+
" Tries the best effort to the find the opening '(' which marks a multi line
" expression. However, sometimes it well balanced, meaning there is not such
" opening locally, or such an opening would give too much indent (immediate
@@ -255,7 +267,7 @@ function! s:FindFirstUnbalancedParen(lines)
if match(line, '\v^.+\(.*<function>' ) > -1
return s:GetStringIndent(line) + &shiftwidth
else
- return i + 1
+ return s:GetIndentWidth(line, i) + 1
endif
endif
endif
The text was updated successfully, but these errors were encountered:
Cleaned up version of suokko's fix from:
raymond-w-ko#2
(Renaming and making the new func more like GetStringIndent.)
We must \t as &shiftwidth instead of a single char. Can't use
GetStringIndent because it stops when it hits non whitespace and making
it support both cases is awkward.
With `noet sw=8 ts=8` old behaviour:
f = function(a,
b)
print(a)
g = function(a,
b)
end
end
New behaviour fixes indent for g:
f = function(a,
b)
print(a)
g = function(a,
b)
end
end
If noet is enabled and I try to use multiline function parameters indention counts characters without expanding tabs to shiftwidth. I made an quick local fix but I'm not exactly sure if that is completely correct.
The text was updated successfully, but these errors were encountered: