Better comment inserting tests and fix implementation

This commit is contained in:
Dmitry Matveyev 2021-06-06 14:08:40 +06:00
parent 785f7fe9ed
commit 167cffb3da
3 changed files with 8 additions and 2 deletions

View File

@ -95,7 +95,7 @@ define-command -hidden elixir-trim-indent %{
define-command -hidden elixir-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