diff --git a/rc/filetype/rust.kak b/rc/filetype/rust.kak index bb998216..35788fd8 100644 --- a/rc/filetype/rust.kak +++ b/rc/filetype/rust.kak @@ -75,7 +75,7 @@ define-command -hidden rust-indent-on-new-line %~ evaluate-commands -draft -itersel %< # copy // comments prefix and following white spaces try %{ - execute-keys -draft k s ^\h*\K//[!/]?\h* y gh j P + execute-keys -draft k s ^\h*//[!/]?\h* y gh j P } catch %` # preserve previous line indent try %{ execute-keys -draft K } diff --git a/test/indent/rust/comment/cmd b/test/indent/rust/comment/cmd new file mode 100644 index 00000000..8682d51e --- /dev/null +++ b/test/indent/rust/comment/cmd @@ -0,0 +1 @@ +cbar diff --git a/test/indent/rust/comment/in b/test/indent/rust/comment/in new file mode 100644 index 00000000..bb887d68 --- /dev/null +++ b/test/indent/rust/comment/in @@ -0,0 +1,8 @@ + // foo%( ) + + //! foo%( ) + + /// foo%( ) + + println!("hello world"); // foo%( ) + diff --git a/test/indent/rust/comment/out b/test/indent/rust/comment/out new file mode 100644 index 00000000..813ec7f2 --- /dev/null +++ b/test/indent/rust/comment/out @@ -0,0 +1,11 @@ + // foo + // bar + + //! foo + //! bar + + /// foo + /// bar + + println!("hello world"); // foo + bar diff --git a/test/indent/rust/comment/rc b/test/indent/rust/comment/rc new file mode 100644 index 00000000..64064c25 --- /dev/null +++ b/test/indent/rust/comment/rc @@ -0,0 +1,3 @@ +source "%val{runtime}/colors/default.kak" +source "%val{runtime}/rc/filetype/rust.kak" +set buffer filetype rust