1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-26 04:52:53 +03:00

Rust align open paren for if and for

This commit is contained in:
Ivan Tham 2020-09-27 15:52:42 +08:00
parent dd1a582b30
commit 11d98a07dc
3 changed files with 19 additions and 1 deletions

View File

@ -174,7 +174,7 @@ define-command -hidden rust-indent-on-opening-curly-brace %[
# align indent with opening paren when { is entered on a new line after the closing paren
try %[ execute-keys -draft h <a-F> ) M <a-k> \A\(.*\)\h*\n\h*\{\z <ret> s \A|.\z <ret> 1<a-&> ]
# dedent standalone { after impl and related block without any { in between
try %< execute-keys -draft hh <a-?> impl|fn|struct|enum|union <ret> <a-K> \{ <ret> <a-semicolon> <semicolon> ll <a-x> <a-k> ^\h*\{$ <ret> <a-lt> >
try %< execute-keys -draft hh <a-?> impl|fn|struct|enum|union|if|for <ret> <a-K> \{ <ret> <a-semicolon> <semicolon> ll <a-x> <a-k> ^\h*\{$ <ret> <a-lt> >
_
]

View File

@ -33,3 +33,12 @@
union X<T> where T: Debug %( )
if foo()
&& bar()
%( )
for x in group
.iter()
.sorted_by(|a, b| Ord::cmp(&a.0, &b.0))
%( )

View File

@ -33,3 +33,12 @@
union X<T> where T: Debug {
if foo()
&& bar()
{
for x in group
.iter()
.sorted_by(|a, b| Ord::cmp(&a.0, &b.0))
{