diff --git a/rc/filetype/ruby.kak b/rc/filetype/ruby.kak index 9c94b7be1..feeb6347f 100644 --- a/rc/filetype/ruby.kak +++ b/rc/filetype/ruby.kak @@ -173,7 +173,7 @@ define-command -hidden ruby-indent-on-new-line %{ define-command -hidden ruby-insert-on-new-line %[ evaluate-commands -no-hooks -draft -itersel %[ # copy _#_ comment prefix and following white spaces - try %{ exec -draft k s ^\h*#\h* y jgh P } + try %{ exec -draft k s ^\h*\K#\h* y jgi P } # wisely add end structure evaluate-commands -save-regs x %[ try %{ execute-keys -draft k s ^ \h + \" x y } catch %{ reg x '' } diff --git a/test/indent/ruby/insert-comment-hash/cmd b/test/indent/ruby/insert-comment-hash/cmd index e3036a407..bd828f357 100644 --- a/test/indent/ruby/insert-comment-hash/cmd +++ b/test/indent/ruby/insert-comment-hash/cmd @@ -1 +1 @@ -c +cjo# comment3comment4jo# indentedindented2 diff --git a/test/indent/ruby/insert-comment-hash/out b/test/indent/ruby/insert-comment-hash/out index bde83b7ae..1dba5ac91 100644 --- a/test/indent/ruby/insert-comment-hash/out +++ b/test/indent/ruby/insert-comment-hash/out @@ -1,2 +1,8 @@ # Comment # comment2 + +# comment3 +# comment4 + +# indented +# indented2