Add ability to specify register when yanking #544
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
NERDCommenterYank(\cy) yanks to the default unnamed register". Like all other yanking, this is a good default, this gives the user an option to choose another register.One use case is creating a “comment and duplicate” function/mapping without clobbering the default register, as discussed in #435.
Closes #543
Goals
["x][count]\cy- Support standard register specification for NERDCommenterYank mapping, as with["x]yyand 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).nmap \abc "x\cyNERDComment({mode}, {type}, [{register}])- Specify register whentype=Yank.let g:NERDDefaultRegister = x- Set default register used by NERDCommenterYank."(so no behavior change by default) and is overridden when specifying a register with"x.Validation
This works for me in vim 9.1.
I'm brand new to vim help files, and not much better at vimscript, so additional eyes and feedback are welcome.