Skip to content

Send command to terminal even if nothing is selected. #138647

@lamyergeier

Description

@lamyergeier
  • My keybindings.json
    {
        "key": "alt+l",
        "command": "workbench.action.terminal.sendSequence",
        "args": { "text": "\u000AMdLink \"${file}\" \"${selectedText}\" \u000A" },
        "when": "!editorReadonly"
        //"when": "!editorReadonly && editorLangId == 'markdown'"
    }

It executes a bash script called MdLink with arguments path of the file and the selected text.

This script should do something special when a text is selected. And when nothing is selected, then I want the script to do something general. I know that I can create another keybinding without selectedText variable but its not elegant.

But the shortcut fails if no text is selected. May be its useful to still run the command even if no text is selected.

Metadata

Metadata

Assignees

Labels

*as-designedDescribed behavior is as designed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions