From bfca07da4d52b821c67a5b4e3eb056df9d98bd55 Mon Sep 17 00:00:00 2001 From: Ivan Tham Date: Wed, 30 Sep 2020 00:37:35 +0800 Subject: [PATCH] Rust not to indent on hash --- rc/filetype/rust.kak | 2 +- test/indent/rust/line-start-with-operator/in | 2 ++ test/indent/rust/line-start-with-operator/out | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/rc/filetype/rust.kak b/rc/filetype/rust.kak index d4b9826c..9117de8e 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 0b17056b..063f771e 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 f81bfdec..f270d0d9 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 +