diff --git a/rc/filetype/rust.kak b/rc/filetype/rust.kak index d4b9826cd..9117de8ee 100644 --- a/rc/filetype/rust.kak +++ b/rc/filetype/rust.kak @@ -154,7 +154,7 @@ define-command -hidden rust-indent-on-new-line %~ try %< execute-keys -draft [c[({],[)}] \A[({][^\n]+\n[^\n]*\n?\z L i > # indent after non-empty lines not starting with operator and not ending with , or ; # XXX simplify this into a single without s - try %< execute-keys -draft k s [^\h].+ \A[-+*/&|^})] [,](\h*/[/*].*|)$ j > + try %< execute-keys -draft k s [^\h].+ \A[-+*/&|^})#] [,](\h*/[/*].*|)$ j > # dedent after lines starting with . and ending with } or ) or , or ; try %_ execute-keys -draft k ^\h*\..*[}),]\h*$ j _ # align to opening curly brace or paren when newline is inserted before a single closing diff --git a/test/indent/rust/line-start-with-operator/in b/test/indent/rust/line-start-with-operator/in index 0b17056b6..063f771e5 100644 --- a/test/indent/rust/line-start-with-operator/in +++ b/test/indent/rust/line-start-with-operator/in @@ -24,3 +24,5 @@ > foo%( ) + #[derive(Debug)]%( ) + diff --git a/test/indent/rust/line-start-with-operator/out b/test/indent/rust/line-start-with-operator/out index f81bfdec9..f270d0d92 100644 --- a/test/indent/rust/line-start-with-operator/out +++ b/test/indent/rust/line-start-with-operator/out @@ -37,3 +37,6 @@ > foo bar + #[derive(Debug)] + bar +