Rust not to indent on hash

This commit is contained in:
Ivan Tham 2020-09-30 00:37:35 +08:00
parent 56e12013c8
commit bfca07da4d
3 changed files with 6 additions and 1 deletions

View File

@ -154,7 +154,7 @@ define-command -hidden rust-indent-on-new-line %~
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 ;
# 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 ;
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

View File

@ -24,3 +24,5 @@
> foo%( )
#[derive(Debug)]%( )

View File

@ -37,3 +37,6 @@
> foo
bar
#[derive(Debug)]
bar