Vim: Cannot remap move pane keybinds

Created on 9 May 2018  路  15Comments  路  Source: VSCodeVim/Vim

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
statuduplicate

Most helpful comment

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"]
    }
  ],

All 15 comments

Sorry, there was regression of #2600, it should be fixed in #2628.

I didn't look into #2628. thx!

We'll push out a patch release shortly.

hmm, should check if above config works after #2628.
I think ctrl+h should work without above PR, but in @kdnk environment, it raises an error command 'extension.vim_navigateLeft' not found.

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'],
        },
    ]

@jpoon @tyru It's works! Thanks!

@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 :)

Hi all

I'm a bit confused by this thread. I have the same issue where I've added the following in my keybindings.json:

  {
    "key": "ctrl+h",
    "command": "extension.vim_navigateLeft",
    "when": "vim.active && vim.use<C-w>",
  },
  {
    "key": "ctrl+l",
    "command": "extension.vim_navigateRight",
    "when": "vim.active && vim.use<C-w>",
  },

Today I noticed the command 'extension.vim_navigateLeft' not found and command 'extension.vim_navigateRight' not found error when pressing ctrl+h聽 and ctrl+l respectively.

Adding the snippet from https://github.com/VSCodeVim/Vim/issues/2634#issuecomment-387650336 does not change anything.

Could you please tell me the steps needed to resolve this. I usually have two or more panes open and use these shortcuts constantly so this issue really breaks my workflow.

@eysi09
It's seems to be some typos in above commet.
I just paste the following to User settings and it' works.

  "vim.otherModesKeyBindingsNonRecursive": [
    {
      "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.

@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.

@CodingJonas I'm sorry, but I've never set the keybind, so I don't know how to config what you want.

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"]
    }
  ],

Also experiencing the same issue as @CodingJonas. Previously I was able to navigate from a file to the file explorer tab on the left using ctrl+h and then back to the file with ctrl+l. Now I can still navigate to the file explorer with ctrl+h but I can't navigate away from the file explorer with ctrl+l. This really breaks the flow when jumping between panes.

@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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lucastheisen picture lucastheisen  路  3Comments

edwintorok picture edwintorok  路  3Comments

gerardmrk picture gerardmrk  路  3Comments

Jimmy-Z picture Jimmy-Z  路  3Comments

waltiam picture waltiam  路  3Comments