Vim: "d" does not respect remappings of movement keys

Created on 18 Dec 2017  路  12Comments  路  Source: VSCodeVim/Vim

Colemak users remap "hjkl" to "snei", after doing this:

dn -> should be equivalent to dj on a non-remapped config.

Instead dn does "delete to next match" as if n hadn't been remapped to j.

I tried to remap dn to dj using the config but that also didn't work.

areremap help wanted kinbug

Most helpful comment

I'm a Dvorak user who is also experiencing the same issue. I use "htns" instead of "hjkl" and pressing "dt" does the same thing as if I had not mapped "t" to "j".

A fix for this would be very much appreciated.

All 12 comments

This is similar to #2233 but more broken.

This is actually expected vim behaviour the last I checked; and why I want langmaps added, which do exactly what you're looking for (issue #2217 )
Nevermind, this was wrong

@aCuteLittleBox actually this works fine in vim, definitely not expected behaviour. Vim manual also explains it. Been working this way for the last 10 years I've been using colemak.

Also langmaps aren't the solution for Dvorak/colemak, we went through this for weeks on a colemak mailing list and came to the conclusion that langmaps aren't fit for this purpose... they weren't built for this purpose, using them in this way is like using a spoon to unscrew a screw. Our community maintains a set of mappings that work great in vim/neovim and mostly work in VSCodeVim without using langmaps.

Can you share your user remapping configs @ohjames?

@jpoon

  "vim.insertModeKeyBindings": [
    {
      "before": ["<c-n>"],
      "after": ["<cr>"]
    }
  ],
  "vim.insertModeKeyBindingsNonRecursive": [
    {
      "before": ["<c-j>"],
      "after": ["<c-n>"]
    }
  ],
  "vim.otherModesKeyBindings": [
    {
      "before": ["<c-n>"],
      "after": ["<cr>"]
    },
    {
      "before": ["n"],
      "after": ["<down>"]
    },
    {
      "before": ["e"],
      "after": ["<up>"]
    },
    {
      "before": ["i"],
      "after": ["<right>"]
    }
  ],
  "vim.otherModesKeyBindingsNonRecursive": [
    {
      "before": [";"],
      "after": [":"]
    },
    {
      "before": ["<c-j>"],
      "after": ["<c-n>"]
    },
    {
      "before": ["k"],
      "after": ["n"]
    },
    {
      "before": ["K"],
      "after": ["N"]
    },
    {
      "before": ["u"],
      "after": ["i"]
    },
    {
      "before": ["U"],
      "after": ["I"]
    },
    // {
    //   "before": ["l"],
    //   "after": ["u"]
    // },
    {
      "before": ["L"],
      "after": ["U"]
    },
    {
      "before": ["N"],
      "after": ["J"]
    },
    {
      "before": ["E"],
      "after": ["K"]
    },
    {
      "before": ["I"],
      "after": ["L"]
    },
    {
      "before": ["j"],
      "after": ["e"]
    },
    {
      "before": ["J"],
      "after": ["E"]
    },
    {
      "before": ["l"],
      "after": [],
      "commands": [
        {
          "command": "undo",
          "args": []
        }
      ]
    },
    {
      "before": ["<C-r>"],
      "after": [],
      "commands": [
        {
          "command": "redo",
          "args": []
        }
      ]
    }
  ],

This is taken from this repository: https://github.com/insidewhy/colemak/

It's a popular set of bindings for colemak users that make vim-like applications better for our keyboard layout. A few hundred people are using it.

I'm a Dvorak user who is also experiencing the same issue. I use "htns" instead of "hjkl" and pressing "dt" does the same thing as if I had not mapped "t" to "j".

A fix for this would be very much appreciated.

@davidxmoody I think it we want it one of us is going to have to do it ;) Unfortunately VsCodeVim is super buggy compared to vim plugins for other IDEs :( The awesome typescript/angular support VS Code offers make it worth putting up with though. I don't suppose you also suffer the problem where all of your keybindings stop working (after opening new tabs with ctrl-P and sometimes after saving or switching tabs)?

Sorry to comment on such an old thread but I had to mention that I am kind of glad to see that I am not the only one. I am using jkil though :).

I would like to get my hands dirty but this extension is way to complicated for my baisc knowledge. Also I fear that it might be in vain since VsCodeNeovim is in progress (I hope still) which would make all our problems (also the horrible laggyness) go away! I would rather help that get along more quickly...although I fear that might be even more complex but if anyone has pointers I'd be happy.

My keybindings keep working when opening new tabs with ctrl-P, I have to restart VsCode to have it resister new ones though...

If it's useful, I created this fork where I hardcoded the extension to you colemak remappings: https://github.com/ollyhayes/Colemak-Vim. You can install it from the extension store.

I've been using it for the last year and it's been working really well. Dvorak users or Colemak users that remap differently can make a fork themselves using the same technique probably.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lucastheisen picture lucastheisen  路  3Comments

orn688 picture orn688  路  3Comments

st-schneider picture st-schneider  路  3Comments

spinningarrow picture spinningarrow  路  3Comments

ghost picture ghost  路  3Comments