diff --git a/rc/filetype/ruby.kak b/rc/filetype/ruby.kak index 9c94b7be..feeb6347 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 e3036a40..bd828f35 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 bde83b7a..1dba5ac9 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