Merge remote-tracking branch 'pickfire/indent-rust' into master
This commit is contained in:
commit
1635ddab78
|
@ -152,9 +152,11 @@ define-command -hidden rust-indent-on-new-line %~
|
||||||
try %{ execute-keys -draft <semicolon> K <a-&> }
|
try %{ execute-keys -draft <semicolon> K <a-&> }
|
||||||
# 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 ; or {
|
||||||
# XXX simplify this into a single <a-k> without s
|
# 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> >
|
||||||
|
# indent after lines ending with {
|
||||||
|
try %< execute-keys -draft k <a-x> <a-k> \{$ <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> _
|
||||||
# align to opening curly brace or paren when newline is inserted before a single closing
|
# align to opening curly brace or paren when newline is inserted before a single closing
|
||||||
|
|
|
@ -26,3 +26,8 @@
|
||||||
|
|
||||||
#[derive(Debug)]%( )
|
#[derive(Debug)]%( )
|
||||||
|
|
||||||
|
fn foo(
|
||||||
|
) -> {%( )
|
||||||
|
|
||||||
|
} else {%( )
|
||||||
|
|
||||||
|
|
|
@ -40,3 +40,10 @@
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
bar
|
bar
|
||||||
|
|
||||||
|
fn foo(
|
||||||
|
) -> {
|
||||||
|
bar
|
||||||
|
|
||||||
|
} else {
|
||||||
|
bar
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user