Rust dedent after .await
This commit is contained in:
parent
ffbdcaa95c
commit
1965b909e1
|
@ -157,8 +157,8 @@ define-command -hidden rust-indent-on-new-line %~
|
||||||
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 {
|
# indent after lines ending with {
|
||||||
try %< execute-keys -draft k <a-x> <a-k> \{$ <ret> j <a-gt> >
|
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 ; or .await
|
||||||
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*\. <ret> <a-k>([}),<semicolon>]|\.await)\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
|
||||||
try %< execute-keys -draft <a-h> <a-k> ^\h*[)}] <ret> h m <a-S> 1<a-&> >
|
try %< execute-keys -draft <a-h> <a-k> ^\h*[)}] <ret> h m <a-S> 1<a-&> >
|
||||||
# todo dedent additional unmatched parenthesis
|
# todo dedent additional unmatched parenthesis
|
||||||
|
|
1
test/indent/rust/dedent-async/cmd
Normal file
1
test/indent/rust/dedent-async/cmd
Normal file
|
@ -0,0 +1 @@
|
||||||
|
c<ret>bar<esc>
|
5
test/indent/rust/dedent-async/in
Normal file
5
test/indent/rust/dedent-async/in
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
foo()
|
||||||
|
.await%( )
|
||||||
|
|
||||||
|
foo().await%( )
|
||||||
|
|
7
test/indent/rust/dedent-async/out
Normal file
7
test/indent/rust/dedent-async/out
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
foo()
|
||||||
|
.await
|
||||||
|
bar
|
||||||
|
|
||||||
|
foo().await
|
||||||
|
bar
|
||||||
|
|
3
test/indent/rust/dedent-async/rc
Normal file
3
test/indent/rust/dedent-async/rc
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
source "%val{runtime}/colors/default.kak"
|
||||||
|
source "%val{runtime}/rc/filetype/rust.kak"
|
||||||
|
set buffer filetype rust
|
Loading…
Reference in New Issue
Block a user