Rust reindent where to match block
This commit is contained in:
parent
785cbaeaed
commit
df68a77ed2
|
@ -146,6 +146,8 @@ define-command -hidden rust-indent-on-new-line %~
|
|||
execute-keys K<a-x>1s^[^*]*(\*)<ret>&
|
||||
]
|
||||
} catch %`
|
||||
# re-indent previous line if it starts with where to match previous block
|
||||
try %+ execute-keys -draft k <a-x> <a-k> ^\h*where\b <ret> hh <a-?> impl|fn|struct|enum|union <ret> <a-S> 1<a-&> +
|
||||
# preserve previous line indent
|
||||
try %{ execute-keys -draft <semicolon> K <a-&> }
|
||||
# indent after lines ending with [{(].+ and move first parameter to own line
|
||||
|
|
1
test/indent/rust/before-where/cmd
Normal file
1
test/indent/rust/before-where/cmd
Normal file
|
@ -0,0 +1 @@
|
|||
c<ret>where<ret>bar<esc>
|
2
test/indent/rust/before-where/in
Normal file
2
test/indent/rust/before-where/in
Normal file
|
@ -0,0 +1,2 @@
|
|||
impl X for T%( )
|
||||
|
4
test/indent/rust/before-where/out
Normal file
4
test/indent/rust/before-where/out
Normal file
|
@ -0,0 +1,4 @@
|
|||
impl X for T
|
||||
where
|
||||
bar
|
||||
|
3
test/indent/rust/before-where/rc
Normal file
3
test/indent/rust/before-where/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