1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-09-20 01:08:33 +03:00

Rust indent after standalone where

This commit is contained in:
Ivan Tham 2020-05-31 18:13:04 +08:00
parent de4b7f3864
commit b1beea8638
5 changed files with 18 additions and 0 deletions

View File

@ -83,6 +83,8 @@ define-command -hidden rust-indent-on-new-line %~
try %[ execute-keys -draft k <a-x> <a-k> [{(]\h*$ <ret> j <a-gt> ]
# indent after lines ending with [{(].+ and move first parameter to own line
try %< execute-keys -draft [c[({],[)}] <ret> <a-k> \A[({][^\n]+\n[^\n]*\n?\z <ret> L i<ret><esc> <gt> <a-S> <a-&> >
# indent lines with a standalone where
try %+ execute-keys -draft k <a-x> <a-k> ^\h*where\h*$ <ret> j <a-gt> +
# dedent after lines starting with . and ending with , or ;
try %_ execute-keys -draft k <a-x> <a-k> ^\h*\..*[,<semicolon>]\h*$ <ret> j <a-lt> _
# todo dedent additional unmatched parenthesis

View File

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

View File

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

View File

@ -0,0 +1,7 @@
impl X for T where
bar
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