Rust take indentation before comment to next line

This commit is contained in:
Ivan Tham 2020-05-24 11:20:24 +08:00
parent 7c791f130c
commit dd3257e3f2
5 changed files with 24 additions and 1 deletions

View File

@ -75,7 +75,7 @@ define-command -hidden rust-indent-on-new-line %~
evaluate-commands -draft -itersel %< evaluate-commands -draft -itersel %<
# copy // comments prefix and following white spaces # copy // comments prefix and following white spaces
try %{ try %{
execute-keys -draft k <a-x> s ^\h*\K//[!/]?\h* <ret> y gh j P execute-keys -draft k <a-x> s ^\h*//[!/]?\h* <ret> y gh j P
} catch %` } catch %`
# preserve previous line indent # preserve previous line indent
try %{ execute-keys -draft <semicolon> K <a-&> } try %{ execute-keys -draft <semicolon> K <a-&> }

View File

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

View File

@ -0,0 +1,8 @@
// foo%( )
//! foo%( )
/// foo%( )
println!("hello world"); // foo%( )

View File

@ -0,0 +1,11 @@
// foo
// bar
//! foo
//! bar
/// foo
/// bar
println!("hello world"); // foo
bar

View File

@ -0,0 +1,3 @@
source "%val{runtime}/colors/default.kak"
source "%val{runtime}/rc/filetype/rust.kak"
set buffer filetype rust