Run VS code internal commands directly from editor by click or hotkey
Requirements
- Visual Studio Code 1.48+
How to Use
-
Only tested on Windows
-
By default the extention is enabled, you can toggle it using the command palette. Trigger the command palette (Ctrl / Cmd + Shift + P) -> Command Runner: Enable / Disable.
Cmds
- Once it is enabled, above every line that contains the symbols
$>followed by a code snipped (between ``backticks\) appears a button to execute the command (or run the current line or nearest cursor line byalt+jkey), like:
$> `cursorDown`
- Also can run multiple commands, separated by "|":
$> `cursorUp|cursorUp|cursorUp`
- With arguments + eval
cmd[eval("arg")]
$> `vscode.open[vscode.Uri.file("C:/Folder/File.txt")]`
- Eval commands and see their values at toast notification and console log
eval(cmd)
$> `eval(vscode.window.activeTextEditor.document.fileName)`
$> `eval(vscode.workspace.workspaceFolders)`
$> `eval(1 + 2)`
Aliases
- Open file/folder (at VS Code) alias
opener("FILEPATH")
$> `opener("C:/Folder/File.txt")`
$> `opener("C:/")`
- Reveal at explorer alias
revealer("PATH")
$> `revealer("C:/Folder/")`
$> `revealer("C:/Folder/File.txt")`
- For both reveal or open: path must exist, the last slash is optional, works with relative path or wildcard (* at the end will open the closest match in case of file or folder)
$> `opener("./../../../Folder/File.txt")`
$> `revealer("C:/Users/lic*")`
$> `opener("C:/Users/Des*")`
- Environmental variables also works.
- VS Code:
${key:value} - Win:
%var%
$> `eval("${config:workbench.colorTheme}")`
$> `opener("%ComSpec%")`
$> `revealer("%APPDATA%")`
$> `revealer("${env:USERPROFILE}")`
- Copy to clipboard
$> `copy("TEXT")`