Better comment inserting tests and fix implementation

This commit is contained in:
Dmitry Matveyev 2021-06-06 14:13:34 +06:00
parent fcc04384d1
commit 0b1654b0cf
3 changed files with 8 additions and 2 deletions

View File

@ -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 <a-x> s ^\h*#\h* <ret> y jgh P }
try %{ exec -draft k <a-x> s ^\h*\K#\h* <ret> y jgi P }
# wisely add end structure
evaluate-commands -save-regs x %[
try %{ execute-keys -draft k <a-x> s ^ \h + <ret> \" x y } catch %{ reg x '' }

View File

@ -1 +1 @@
c<ret>
c<ret><esc><a-o>jo# comment3<ret>comment4<esc><a-o>jo# indented<ret>indented2

View File

@ -1,2 +1,8 @@
# Comment
# comment2
# comment3
# comment4
# indented
# indented2