Skip to content

Add support for when clause in commands #2030

@avishnyak

Description

@avishnyak
  • Click thumbs-up 👍 on this issue if you want it!
  • Click confused 😕 on this issue if not having it makes VSCodeVim unusable.

The VSCodeVim team prioritizes issues based on reaction count.


FEATURE REQUEST:

Support "when" in custom binding commands. This will allow one to create toggle commands that do different things based on the state of the editor.

For example:

"vim.otherModesKeyBindingsNonRecursive": [
        {
            "before": ["-"],
            "commands": [
                {
                    "command": "workbench.files.action.focusFilesExplorer",
                    "when": "editorFocus",
                    "args": []
                },
                {
                    "command": "workbench.action.toggleSidebarVisibility",
                    "when": "explorerViewletFocus",
                    "args": []
                }
            ]
        }
    ]

Pressing - while focused on an editor, shows and sets focus to the file explorer. Pressing - in the file explorer, closes the explorer sidebar and sets you back into the editor.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions