Vim: Cannot remap move pane keybinds

Is this a BUG REPORT or FEATURE REQUEST? (choose one):

I’m not sure. bug or just question.

What happened:

I remapped move pane to right/left/up/down keybinds to ctrl-l/h/k/j only in a Normal mode like below.

  {
    "key": "ctrl+h",
    "command": "extension.vim_navigateLeft",
    "when": "vim.active && editorTextFocus && vim.mode == 'Normal' "
  },
  {
    "key": "ctrl+l",
    "command": "extension.vim_navigateRight",
    "when": "vim.active && editorTextFocus && vim.mode == 'Normal'"
  },

But after upgraded to latest version of this extension, I got error messages like command 'extension.vim_navigateLeft' not found.

I was found some commands changes in #2600, But I don’t know how to reconfig the keybinds.

What did you expect to happen:

I’d like to use ctrl-l/h/k/j keybinds in Normal mode for move pane.

How to reproduce it (as minimally and precisely as possible):

Environment:

  • Extension (VsCodeVim) version: v0.11.6
  • VSCode version: Version 1.23.0 (1.23.0)
  • OS version: macOS 10.13.4

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

Quick update since I ran into this again, but otherModesKeyBindingsNonRecursive is now normalModesKeyBindingsNonRecursive as per #2726.

So for completeness, in your USER SETTINGS you’ll need:

  "vim.normalModeKeyBindingsNonRecursive": [
    {
      "before": ["<C-h>"],
      "after": ["<C-w>", "h"]
    },
    {
      "before": ["<C-l>"],
      "after": ["<C-w>", "l"]
    }
  ],

@kdnk You’re right, it does work. Thanks!

For anyone else who stumbles into this, you must remove the corresponding keybindings from keybindings.json and add the snippet above.

@eysi09 Did you ever figure this out? Your keybinding suggestion doesn’t work for me. Perhaps you’ve moved on… thanks.

Edit: This worked for me! https://stackoverflow.com/a/50593160/243157

@kdnk thank you for you solution. Just one thing is not working as before: I can’t move from the file explorer to a panel on it’s right.

“extension.vim_navigateRight” allowed to move from the file explorer to the code on its right,

        {
            "before": ["<C-l>"],
            "after": ["<C-w>", "l"]
        }

does not work.

@jpoon Thanks for follow up. I’m not used to VSCode extension development yet, especially package.json is unknown territory…

@kdnk Thanks for checking! I was thinking about checking it after getting home, but now I don’t need it 😃

Ugh, you are totally right. johnfn expressed his concerns with doing the remapping the original way (in the package.json) and I agree with him https://github.com/VSCodeVim/Vim/pull/1504#issuecomment-298490543 that isn’t a direction we should go into as we can’t remap those keys.

@kdnk instead of using vscode’s key remapping, you can use vscodevim’s and rebind your <c-h> like this:

    "vim.otherModesKeyBindingsNonRecursive": [
        {
            "before":["<C-h>"],
            "after":[<C-w>', 'j'],
        },
    ]