Feature/fix black hole operator mappings #3081
Merged
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.
What this PR does / why we need it:
It is somewhat common in Vim to remap keys to copy to the black hole register, when the user doesn't want to modify the default register. In our current remapping system, this wasn't supported with operators when the operator was a repeated key press (e.g.
dd
with"_d
mapped).Vanilla Vim seems to disregard key mappings if an operator is in progress.
dd
with"_d
mapped should result in"_dd
, not"_d"_d
. So this change seems in line with vanilla as far as that goes.Therefore, with this PR, the following vscode setting should allow e.g.
dd
anddw
to become"_dd
and"_dw
, thereby yanking to the black hole register and not overwriting the default register or the system clipboard.Which issue(s) this PR fixes
fixes #2672
Special notes for your reviewer:
Note that there are still issues with mapping, such as if you want to map both
d
anddd
. But those don't appear to be regressions. Vanilla Vim handles the following scenarios:It seems we would need to e.g. revamp how the remapper timeouts work in ModeHandler if we wanted to handle these. I could open a separate GitHub issue to tackle that.