Rust reindent where to match block

This commit is contained in:
Ivan Tham 2020-09-28 00:03:53 +08:00
parent 785cbaeaed
commit df68a77ed2
5 changed files with 12 additions and 0 deletions

View File

@ -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

View File

@ -0,0 +1 @@
c<ret>where<ret>bar<esc>

View File

@ -0,0 +1,2 @@
impl X for T%( )

View File

@ -0,0 +1,4 @@
impl X for T
where
bar

View File

@ -0,0 +1,3 @@
source "%val{runtime}/colors/default.kak"
source "%val{runtime}/rc/filetype/rust.kak"
set buffer filetype rust