question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remapping the "y" key to "<left>" still trigger the yank action

See original GitHub issue

Describe 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:

  1. Set the following settings:
"vim.normalModeKeyBindings": [
    {
        "before": ["y"],
        "after": ["<left>"]
    }
]
  1. Open a text file
  2. Try navigating to the left using y
  3. 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:open
  • Created a year ago
  • Reactions:1
  • Comments:8

github_iconTop GitHub Comments

1reaction
gracicotcommented, Jun 21, 2022

@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 to h. Also, note that even if the extension waits for the second y, it won’t yank as there is nothing mapped to yy. I would insist that this is a problem in vscode vim since it fails to reproduce the behaviour of all vim implementations I tried.

1reaction
northernoceancommented, Mar 26, 2022

yy is a standard key mapping to yank the current line. what you will find is that if you type y once, vim is waiting to see if you type it again. So for example, press y and wait a second. You will get movement to the left. Press yy quickly - you will yank the current line. Press y a bunch of times … well, frankly I don’t know what should happen with all those ys and yys 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Remapping the keyboard - IBM
To access the Keyboard window, either click the Remap button on the toolbar, click Edit > Preferences > Keyboard, or click Keyboard in...
Read more >
Remapping Keys (Keyboard, Mouse and Joystick) - AutoHotkey
Free keyboard remapper that can also remap mouse and joystick buttons. It can also automate repetitive tasks by sending keystrokes & mouse clicks....
Read more >
How to Train Your Keyboard - Tighten Co.
We are going to learn how to train our keyboards to map the key ... the P key, Karabiner should trigger the hyper...
Read more >
Remap keys conflicting with plugin - Vi and Vim Stack Exchange
vimrc: map <Up> <C-y> , pressing up will trigger yankring. So is there a way to remap Vim's default key mapping (or map...
Read more >
How To Remap the Keys on Any Laptop - Gizmodo
Here's what you need to do to customize your key bindings on Windows laptops, MacBooks, ... you'll see all these tools listed on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found