Dedent rust empty match
This commit is contained in:
parent
978dfe4bdf
commit
049591f6b4
|
@ -98,7 +98,7 @@ define-command -hidden rust-trim-indent %{
|
|||
}
|
||||
|
||||
define-command -hidden rust-indent-on-new-line %~
|
||||
evaluate-commands -draft -itersel %<
|
||||
evaluate-commands -draft -itersel %@
|
||||
try %{
|
||||
try %[ # line comment
|
||||
evaluate-commands -draft -save-regs '/"' %[
|
||||
|
@ -159,6 +159,8 @@ define-command -hidden rust-indent-on-new-line %~
|
|||
try %< execute-keys -draft k <a-x> <a-k> \{$ <ret> j <a-gt> >
|
||||
# dedent after lines starting with . and ending with } or ) or , or ; or .await
|
||||
try %_ execute-keys -draft k <a-x> <a-k> ^\h*\. <ret> <a-k>([}),<semicolon>]|\.await)\h*$ <ret> j <a-lt> _
|
||||
# dedent after lines ending with " => {}" - part of empty match
|
||||
try %# execute-keys -draft k <a-x> <a-k> \ =>\ \{\}\h*$ <ret> j <a-lt> #
|
||||
# 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-&> >
|
||||
# todo dedent additional unmatched parenthesis
|
||||
|
@ -169,7 +171,7 @@ define-command -hidden rust-indent-on-new-line %~
|
|||
`
|
||||
# filter previous line
|
||||
try %{ execute-keys -draft k : rust-trim-indent <ret> }
|
||||
>
|
||||
@
|
||||
~
|
||||
|
||||
define-command -hidden rust-indent-on-opening-curly-brace %[
|
||||
|
|
1
test/indent/rust/empty-match/cmd
Normal file
1
test/indent/rust/empty-match/cmd
Normal file
|
@ -0,0 +1 @@
|
|||
c<ret>bar<esc>
|
3
test/indent/rust/empty-match/in
Normal file
3
test/indent/rust/empty-match/in
Normal file
|
@ -0,0 +1,3 @@
|
|||
match a {
|
||||
Some(a) => {}%( )
|
||||
|
4
test/indent/rust/empty-match/out
Normal file
4
test/indent/rust/empty-match/out
Normal file
|
@ -0,0 +1,4 @@
|
|||
match a {
|
||||
Some(a) => {}
|
||||
bar
|
||||
|
3
test/indent/rust/empty-match/rc
Normal file
3
test/indent/rust/empty-match/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