t9md / atom-vim-mode-plus

vim-mode improved
https://atom.io/packages/vim-mode-plus
MIT License
1.4k stars 111 forks source link

Help needed creating custom operator #927

Closed nwaywood closed 6 years ago

nwaywood commented 6 years ago

I have an operator that I want to make, which I will either release as a seperate vim-mode-plus plugin or include within vim-mode-plus, whichever you prefer :) However I need some help from you please @t9md

What the operator does

It operates on a visual mode line selection (or a single line if it normal mode) and creates a copy of the selection and comments out the original.

For example, if I had three lines selected in visual mode

image

executing this new operator would result in the code turning into this:

image

Similarly, operating on a single line would turn

image

into

image

I would really appreciate any help on how I would write this.

Thanks in advance

t9md commented 6 years ago

I like your idea.

So experimentally will introduce DuplicateWIthCommentOutOriginal in next-release. You can see how I implemented(#929).