diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2020-08-06 13:22:17 +0200 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2020-08-06 13:22:17 +0200 |
commit | 1e533e5982a9c80f262b09fbe94e1ac4555ad915 (patch) | |
tree | ed573a3e399a95c2c3baeb6a1371d4753357cecc /indent/lua.vim | |
parent | 56121b4e27cb48efb17be55a969b2f0d725266f8 (diff) | |
download | vim-polyglot-1e533e5982a9c80f262b09fbe94e1ac4555ad915.tar.gz vim-polyglot-1e533e5982a9c80f262b09fbe94e1ac4555ad915.zip |
Update
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 |