Add rust test for empty line indent

This commit is contained in:
Ivan Tham 2020-09-27 23:34:08 +08:00
parent 5c8dfcdfa9
commit 785cbaeaed
5 changed files with 10 additions and 1 deletions

View File

@ -151,7 +151,7 @@ define-command -hidden rust-indent-on-new-line %~
# indent after lines ending with [{(].+ and move first parameter to own line # indent after lines ending with [{(].+ and move first parameter to own line
try %< execute-keys -draft [c[({],[)}] <ret> <a-k> \A[({][^\n]+\n[^\n]*\n?\z <ret> L i<ret><esc> <gt> <a-S> <a-&> > try %< execute-keys -draft [c[({],[)}] <ret> <a-k> \A[({][^\n]+\n[^\n]*\n?\z <ret> L i<ret><esc> <gt> <a-S> <a-&> >
# indent after non-empty lines not starting with operator and not ending with , or ; # indent after non-empty lines not starting with operator and not ending with , or ;
# XXX s [^\h]* is workaround for broken negate match #3766, use this later # XXX simplify this into a single <a-k> without s
try %< execute-keys -draft k <a-x> s [^\h].+ <ret> <a-K> \A[-+*/&|^})<gt><lt>] <ret> <a-K> [,<semicolon>](\h*/[/*].*|)$ <ret> j <a-gt> > try %< execute-keys -draft k <a-x> s [^\h].+ <ret> <a-K> \A[-+*/&|^})<gt><lt>] <ret> <a-K> [,<semicolon>](\h*/[/*].*|)$ <ret> j <a-gt> >
# dedent after lines starting with . and ending with } or ) or , or ; # dedent after lines starting with . and ending with } or ) or , or ;
try %_ execute-keys -draft k <a-x> <a-k> ^\h*\..*[}),<semicolon>]\h*$ <ret> j <a-lt> _ try %_ execute-keys -draft k <a-x> <a-k> ^\h*\..*[}),<semicolon>]\h*$ <ret> j <a-lt> _

View File

@ -0,0 +1 @@
c<ret>bar<esc>

View File

@ -0,0 +1,2 @@
%( )

View File

@ -0,0 +1,3 @@
bar

View File

@ -0,0 +1,3 @@
source "%val{runtime}/colors/default.kak"
source "%val{runtime}/rc/filetype/rust.kak"
set buffer filetype rust