diff options
Diffstat (limited to 'indent/lua.vim')
-rw-r--r-- | indent/lua.vim | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/indent/lua.vim b/indent/lua.vim index 49180347..6eb8ff08 100644 --- a/indent/lua.vim +++ b/indent/lua.vim @@ -31,6 +31,8 @@ let s:close_patt = '\C\%(\<\%(end\|until\)\>\|)\|}\)' let s:anon_func_start = '\S\+\s*[({].*\<function\s*(.*)\s*$' let s:anon_func_end = '\<end\%(\s*[)}]\)\+' +let s:chained_func_call = "^\\v\\s*[:.]\\w+[({\"']" + " Expression used to check whether we should skip a match with searchpair(). let s:skip_expr = "synIDattr(synID(line('.'),col('.'),1),'name') =~# 'luaComment\\|luaString'" @@ -100,6 +102,16 @@ function GetLuaIndent() let i += 1 endif + " if the current line chains a function call to previous unchained line + if contents_prev !~# s:chained_func_call && contents_cur =~# s:chained_func_call + let i += 1 + endif + + " if the current line chains a function call to previous unchained line + if contents_prev =~# s:chained_func_call && contents_cur !~# s:chained_func_call + let i -= 1 + endif + " special case: call(with, {anon = function() -- should indent only once if i > 1 && contents_prev =~# s:anon_func_start let i = 1 |