Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"d" does not respect remappings of movement keys #2234

Closed
insidewhy opened this issue Dec 18, 2017 · 12 comments · Fixed by #4735
Closed

"d" does not respect remappings of movement keys #2234

insidewhy opened this issue Dec 18, 2017 · 12 comments · Fixed by #4735

Comments

@insidewhy
Copy link
Contributor

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.

@insidewhy
Copy link
Contributor Author

This is similar to #2233 but more broken.

@ghost
Copy link

ghost commented Dec 26, 2017

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

@insidewhy
Copy link
Contributor Author

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

@insidewhy
Copy link
Contributor Author

insidewhy commented Dec 26, 2017

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.

@jpoon
Copy link
Member

jpoon commented Dec 26, 2017

Can you share your user remapping configs @ohjames?

@insidewhy
Copy link
Contributor Author

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

@insidewhy
Copy link
Contributor Author

insidewhy commented Jan 16, 2018

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.

@davidxmoody
Copy link

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.

@insidewhy
Copy link
Contributor Author

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

@DrBones
Copy link

DrBones commented May 21, 2018

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

@nornagon
Copy link

Related: #2466, #3086, #3413

@ollyhayes
Copy link

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.

berknam pushed a commit to berknam/Vim that referenced this issue Apr 13, 2020
Refactor the Remapper and ModeHandler to allow better remapping experience.
It will allow to remap operator keys, motion keys and multiple keys when the first key could be handled.

Should fix the following issues (maybe more):
VSCodeVim#4674
VSCodeVim#4464
VSCodeVim#3988
VSCodeVim#3768
VSCodeVim#3742
VSCodeVim#2975
VSCodeVim#2955
VSCodeVim#2234
VSCodeVim#2041
VSCodeVim#1870
VSCodeVim#1821
VSCodeVim#1579
VSCodeVim#1398

Needs more testing.
@berknam berknam mentioned this issue Apr 13, 2020
10 tasks
J-Fields pushed a commit that referenced this issue Aug 16, 2020
This is a pretty massive change; see pull request #4735 for full details

Most notably:
- Support for operator-pending mode, including remaps and a half-cursor decoration
- Correct handling of ambiguous remaps with timeout
- Correct handling of recursive special case when the RHS starts with the LHS
- Correct handling of multi-key remaps in insert mode
- Failed movements that occur partway through a remap stop & discard the rest of the remap
- Implement `unmap` and `mapclear` in .vimrc

Refs #463, refs #4908
Fixes #1261, fixes #1398, fixes #1579, fixes #1821, fixes #1835
Fixes #1870, fixes #1883, fixes #2041, fixes #2234, fixes #2466
Fixes #2897, fixes #2955, fixes #2975, fixes #3082, fixes #3086
Fixes #3171, fixes #3373, fixes #3413, fixes #3742, fixes #3768
Fixes #3988, fixes #4057, fixes #4118, fixes #4236, fixes #4353
Fixes #4464, fixes #4530, fixes #4532, fixes #4563, fixes #4674
Fixes #4756, fixes #4883, fixes #4928, fixes #4991, fixes #5016
Fixes #5057, fixes #5067, fixes #5084, fixes #5125
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants