Remapping the "y" key to "<left>" still trigger the yank action
See original GitHub issueDescribe the bug A clear and concise description of what the bug is.
In an attempt to support the workman layout, I remapped y
to <left>
to support familiar hotkeys for navigation.
The j
, k
and l
seem to work, but I must press y
two times to move left.
To Reproduce Steps to reproduce the behavior:
- Set the following settings:
"vim.normalModeKeyBindings": [
{
"before": ["y"],
"after": ["<left>"]
}
]
- Open a text file
- Try navigating to the left using
y
- Notice that the yank action is still triggered in the status bar, and you have to press
y
multiple times to move.
Expected behavior A clear and concise description of what you expected to happen.
With the key mapping, pressing y
a single time should move to the left.
Screenshots If applicable, add screenshots to help explain your problem. If remapping-related, please attach log output: https://github.com/VSCodeVim/Vim#debugging-remappings.
https://www.youtube.com/watch?v=DMJzEtK6_Cc
Environment (please complete the following information):
- Extension (VsCodeVim) version: 1.22.2
- VSCode version: 1.64.2
- OS: Linux
Additional context Add any other context about the problem here.
I have the keyboard.dispatch
setting to keyCode
.
I’m using the config from this repo: https://github.com/ajgrf/workman-vim-bindings/blob/master/vscode.json
I’m using the workman layout as my keyboard layout.
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:8
@northernocean I can confirm three different implementation of vim don’t behave like this and don’t wait for double tapping
y
when it is remapped toh
. Also, note that even if the extension waits for the secondy
, it won’t yank as there is nothing mapped toyy
. I would insist that this is a problem in vscode vim since it fails to reproduce the behaviour of all vim implementations I tried.yy
is a standard key mapping to yank the current line. what you will find is that if you typey
once, vim is waiting to see if you type it again. So for example, pressy
and wait a second. You will get movement to the left. Pressyy
quickly - you will yank the current line. Pressy
a bunch of times … well, frankly I don’t know what should happen with all thosey
s andyy
s mixed together (sorry).So this is how it works when you have some key that can mean something by itself and something else in combination with another key (a so-called “chord”).
I don’t know of a good solution - I guess ideally you would want to completely remove
yy
from vim’s keymapping (in essence, so it will stop waiting for to see if a second y is pressed after a first y is pressed). But I don’t know if that is possible with a built-in command that has been in vim since forever.