Vim: "Simple" keybindings for Dvorak lead to regular crashing of vim extension - any suggestions appreciated :)

Created on 5 Sep 2020  路  7Comments  路  Source: VSCodeVim/Vim

Describe the bug
Ok so I was super happy to see that some headway had been made on key mappings so that I could make some small changes so I can more easily use VSCode + Vim + Dvorak. So a big thanks for all the contributors hard work to make VSCodeVim a reality.

Unfortunately something I have done leads to regular crashes of the extension. When this happens I disable and re-enable the extension and it rights itself.

Generally it crashes when I am trying to do multi-line stuff or multi-select stuff, at least I think...

To Reproduce
Steps to reproduce the behavior:

Heres my complete settings file.

Additionally I do have a few extensions installed - for different languages, but no snippets libraries or such that may conflict with vim.

{
    "todo-tree.tree.showScanModeButton": false,
    "vim.easymotion": true,
    "vim.incsearch": true,
    "vim.useSystemClipboard": true,
    "vim.useCtrlKeys": true,
    "vim.hlsearch": true,
    "vim.insertModeKeyBindings": [
        {
            "before": ["h", "h"],
            "after": ["<Esc>"]
        }
    ],
    "vim.normalModeKeyBindings": [
        {
            "before": ["h"],
            "after": ["h"]
        },
        {
            "before": ["t"],
            "after": ["j"]
        },
        {
            "before": ["n"],
            "after": ["k"]
        },
        {
            "before": ["s"],
            "after": ["l"]
        },
        {
            "before": ["H"],
            "after": ["0"]
        },
        {
            "before": ["T"],
            "after": ["L"]
        },
        {
            "before": ["N"],
            "after": ["H"]
        },
        {
            "before": ["S"],
            "after": ["$"]
        },
        {
            "before": ["j"],
            "after": ["n"]
        },
        {
            "before": ["J"],
            "after": ["N"]
        },
        {
            "before": ["k"],
            "after": ["s"]
        },
        {
            "before": ["K"],
            "after": ["S"]
        }
    ],
    "vim.visualModeKeyBindings": [
        {
            "before": ["h"],
            "after": ["h"]
        },
        {
            "before": ["t"],
            "after": ["j"]
        },
        {
            "before": ["n"],
            "after": ["k"]
        },
        {
            "before": ["s"],
            "after": ["l"]
        },
        {
            "before": ["H"],
            "after": ["0"]
        },
        {
            "before": ["T"],
            "after": ["L"]
        },
        {
            "before": ["N"],
            "after": ["H"]
        },
        {
            "before": ["S"],
            "after": ["$"]
        },
        {
            "before": ["j"],
            "after": ["n"]
        },
        {
            "before": ["J"],
            "after": ["N"]
        },
        {
            "before": ["k"],
            "after": ["s"]
        },
        {
            "before": ["K"],
            "after": ["S"]
        }
    ],
    "vim.leader": "<space>",
    "vim.handleKeys": {
        "<C-a>": false,
        "<C-f>": false
    },
    "git.enableSmartCommit": true,
    "files.autoSave": "onFocusChange",
    "window.zoomLevel": 1,
    "git.confirmSync": false,
    "codestream.email": "[email protected]",
    "javascript.updateImportsOnFileMove.enabled": "always",
    "explorer.confirmDragAndDrop": false,
    "typescript.updateImportsOnFileMove.enabled": "never",
    "editor.tabSize": 2,
    "compile-hero.disable-compile-files-on-did-save-code": true
 }

Expected behavior
It just works :)

Environment (please complete the following information):

  • Extension (VsCodeVim) version: 1.16.0
  • VSCode version: 1.48.2
  • OS: osx 10.15.6

Most helpful comment

@Spirarel @agentlewis The beta version 1.17.0 is out already.

I posted that message three weeks ago.

Actually not beta 馃檭 there was a miscommunication among maintainers that led 1.17.0 to be released before it was really ready

Sorry to hear it was the result of a miscommunication! I noticed it yesterday though, the remapper is working great! @berknam

All 7 comments

This is crashing probably because you might have recursive mappings. When you're swapping keys you should always use the NonRecursive version of keybindings like so:

"vim.normalModeKeyBindingsNonRecursive": [
...
],
"vim.visualModeKeyBindingsNonRecursive": [
...
],

Since you don't use the NonRecursive versions they will always remap again, so when you have t mapped to j, but then have j mapped to n then t will map to n but then n is mapped to k so t will map to k, and it goes on and on...

There has been a major overhaul of the remapping logic that is already merged on master but is not out yet. It will be out on the next release. With that it will help recognize when you have recursive mappings and it will also make it so some remappings that weren't previously working will start work.

So I think the best you could do now is change your bindings to use the NonRecursive version to see if it works. If it doesn't work then wait for the next release (or try using the current master version) to see if it fixes it for you and then post back here your feedback.

@berknam oh got it! Thanks so much for that explanation. I was following along the overhaul branch/ merge and thought it had been released - my bad. I had tried this a long time ago and ran into the same problem...

I'll give the nonrecursive mapping a go and report back. If it doesn't work I'll just wait for the new release :)

Do we know when that release will be cut? The refactored remapper fixes a ton of pain points with the extension. Last I saw in the PR thread it was said to be coming "next week", but it's been almost 3 now. Do you guys release nightly's somewhere?

@Spirarel @agentlewis The beta version 1.17.0 is out already.

@Spirarel @agentlewis The beta version 1.17.0 is out already.

Actually not beta 馃檭 there was a miscommunication among maintainers that led 1.17.0 to be released before it was really ready

Do you guys release nightly's somewhere?

In the near future there will be a beta channel (not quite nightly, but very fast-moving)

@Spirarel @agentlewis The beta version 1.17.0 is out already.

I posted that message three weeks ago.

Actually not beta 馃檭 there was a miscommunication among maintainers that led 1.17.0 to be released before it was really ready

Sorry to hear it was the result of a miscommunication! I noticed it yesterday though, the remapper is working great! @berknam

I'll give the nonrecursive mapping a go and report back. If it doesn't work I'll just wait for the new release :)

Late Report back: nonrecuesive did kind of work. But the extension still crashes every now and then as I do multi cursor actions :)

Ha I actually captured it in a tweet: https://twitter.com/forge_tools/status/1308370300313038849?s=21

馃榾

Thanks again for the awesome extension - so appreciative of the work and I'll jump onto the new release and see if that helps with the crashes.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

edwintorok picture edwintorok  路  3Comments

ghost picture ghost  路  3Comments

typeoneerror picture typeoneerror  路  3Comments

AndersenJ picture AndersenJ  路  3Comments

stefanoio picture stefanoio  路  3Comments