summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Tham <pickfire@riseup.net>2020-09-30 00:37:35 +0800
committerIvan Tham <pickfire@riseup.net>2020-09-30 00:37:35 +0800
commitbfca07da4d52b821c67a5b4e3eb056df9d98bd55 (patch)
treeb39f1416e009143c731c4ac49d32f299c2cec1dd
parent56e12013c850523a8de983bb4ecc6f66d45a4815 (diff)
Rust not to indent on hash
-rw-r--r--rc/filetype/rust.kak2
-rw-r--r--test/indent/rust/line-start-with-operator/in2
-rw-r--r--test/indent/rust/line-start-with-operator/out3
3 files changed, 6 insertions, 1 deletions
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[({],[)}] <ret> <a-k> \A[({][^\n]+\n[^\n]*\n?\z <ret> L i<ret><esc> <gt> <a-S> <a-&> >
# indent after non-empty lines not starting with operator and not ending with , or ;
# XXX simplify this into a single <a-k> without s
- try %< execute-keys -draft k <a-x> s [^\h].+ <ret> <a-K> \A[-+*/&|^})<gt><lt>] <ret> <a-K> [,<semicolon>](\h*/[/*].*|)$ <ret> j <a-gt> >
+ try %< execute-keys -draft k <a-x> s [^\h].+ <ret> <a-K> \A[-+*/&|^})<gt><lt>#] <ret> <a-K> [,<semicolon>](\h*/[/*].*|)$ <ret> j <a-gt> >
# dedent after lines starting with . and ending with } or ) or , or ;
try %_ execute-keys -draft k <a-x> <a-k> ^\h*\..*[}),<semicolon>]\h*$ <ret> j <a-lt> _
# 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
+