vscode-vimspired icon indicating copy to clipboard operation
vscode-vimspired copied to clipboard

localize the INSERT/NORMAL mode to the editor only

Open code-instable opened this issue 2 years ago • 0 comments

First of all thank you for the amazing and intuitive extension, After using it for over a year now I decided to open an issue on the biggest issue I encounter with that almost perfect extension :

The extension

image

this inconvenience makes the otherwise really simple customization of this extension a logistical nightmare, I have to modify every single keybind in my vscode settings to make sure I enter insert mode when I want to find a command, search, etc... ( and even all the actions tied to the escape key ), and I therefore need to rely on another third-party extension to run multiple commands :

This is also a problem whenever I want to get somewhere using my mouse (because I can't assign enter insert, or go back to normal before or after like in keybindings/settings json )

Here is a small sample of workarounds needed to "solve" the issue manually in settings :

keybindings.json :

//? show help (R)
    {
        "key": "h",
        "command": "extension.multiCommand.execute",
        "args": {
            "sequence": ["vimspired.enterInsert", "r.showHelp"]
        },
        "when": "vimspired.normal && !terminalFocus && editorFocus && editorTextFocus"
    }


// ⭐ SELECT BRACKET ⭐
    // if on insert mode, enter normal mode first
    // 🖥️ full size keyboard ( pageup, pagedown available )
    {
        "key": "pageup",
        "command": "extension.multiCommand.execute",
        "args": {
            "sequence": ["bracket-select.select", "vimspired.enterNormal"]
        },
        "when": "!vimspired.normal"
    },
    // else select the containing bracket
    {
        "key": "pageup",
        "command": "bracket-select.select",
        "when": "vimspired.normal"
    },
    // $ ➡️ include the bracket
    {
        "key": "shift+pageup",
        "command": "extension.multiCommand.execute",
        "args": {
            "sequence": [
                "bracket-select.select-include",
                "vimspired.enterNormal"
            ]
        },
        "when": "!vimspired.normal"
    },
    // else select the containing bracket
    {
        "key": "shift+pageup",
        "command": "bracket-select.select-include",
        "when": "vimspired.normal"
    },

settings.json :

{
...
        // ? 🔎 FIND
        "?": ["vimspired.enterInsert", "actions.find"],
        ".": ["vimspired.enterInsert", "editor.action.startFindReplaceAction"],
        "r": ["vimspired.enterInsert", "editor.action.rename"],
        "%": ["vimspired.enterInsert", "workbench.profiles.actions.switchProfile"]
...
}

tweak proposed :

  • enter insert mode whenever focusing on anything other than an editor
  • enter normal mode whenever focusing an editor when the previous focus was not an editor

( should include input box as well, command search box for instance, ... basically whenever it's anyhting that is not an editor )

so that there is no need for all the workarounds, and works with moving in vscode with the mouse too

Thank you, for this amazing extension, I hope you have some time to implement this !

code-instable avatar Feb 06 '24 10:02 code-instable