nerdcommenter icon indicating copy to clipboard operation
nerdcommenter copied to clipboard

[Feature request] ability to specify register when yanking

Open jacktose opened this issue 8 months ago • 2 comments

NERDCommenterYank yanks to the default unnamed register "". Like all other yanking/pasting in vim, this is a good default, but it's also nice to be able to choose a register. One use case is creating a “comment and duplicate” function/mapping without clobbering the default register, as discussed in #435.

I don't know the internals or the right syntax, but from a UX perspective, I would hope for all of the following:

  • ["x][count]<leader>cy - Support standard register specification for NERDCommenterYank mapping, as with ["x]yy and friends.
  • ["x]<plug>NERDCommenterYank, <plug>NERDCommenterYank({register}), or similar way to specify a register when invoking this way (e.g. in a user-defined function or mapping).
  • NERDComment({mode}, {type}, [{register}]) - Specify register when type=Yank.
  • let g:NerdYankRegister = x - Set default register used by NERDCommenterYank.

jacktose avatar Apr 29 '25 19:04 jacktose

Contributions welcome. This doesn't really have an active maintainer right now but I'm trying to keep up with facilitating PRs when they come along.

alerque avatar Apr 30 '25 11:04 alerque

Well, that was a learning opportunity! Opened #544 and would appreciate your feedback.

jacktose avatar May 06 '25 23:05 jacktose