[PR #14807] Add the ability to select a whole command (or its output) #30261

Closed
opened 2026-01-31 09:39:38 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/14807

State: closed
Merged: Yes


Adds two new commands, selectOutput and selectCommand. These don't do much without shell integration enabled, unfortunately. If you do enable it, however, you can use these commands to quickly navigate the history to select whole commands (or their output).

Some sample JSON:

        { "keys": "ctrl+shift+<", "command": { "action": "selectCommand", "direction": "prev" } },
        { "keys": "ctrl+shift+>", "command": { "action": "selectCommand", "direction": "next" } },
        { "keys": "ctrl+shift+[", "command": { "action": "selectOutput", "direction": "prev" } },
        { "keys": "ctrl+shift+]", "command": { "action": "selectOutput", "direction": "next" } },

Demo gifs in https://github.com/microsoft/terminal/issues/4588#issuecomment-1352042789

closes #4588

Tested manually.

CMD.exe user? It's dangerous to go alone! Take this.

Surely, there's a simpler way to do it, this is adapted from my own script.

prompt $e]133;D$e\$e]133;A$e\$e\$e]9;9;$P$e\$e[30;107m[$T]$e[97;46m$g$P$e[36;49m$g$e[0m$e[K$_$e[0m$e[94m%username%$e[0m@$e[32m%computername%$e[0m$G$e]133;B$e\
**Original Pull Request:** https://github.com/microsoft/terminal/pull/14807 **State:** closed **Merged:** Yes --- Adds two new commands, `selectOutput` and `selectCommand`. These don't do much without shell integration enabled, unfortunately. If you do enable it, however, you can use these commands to quickly navigate the history to select whole commands (or their output). Some sample JSON: ```json { "keys": "ctrl+shift+<", "command": { "action": "selectCommand", "direction": "prev" } }, { "keys": "ctrl+shift+>", "command": { "action": "selectCommand", "direction": "next" } }, { "keys": "ctrl+shift+[", "command": { "action": "selectOutput", "direction": "prev" } }, { "keys": "ctrl+shift+]", "command": { "action": "selectOutput", "direction": "next" } }, ``` **Demo gifs** in https://github.com/microsoft/terminal/issues/4588#issuecomment-1352042789 closes #4588 Tested manually. <details> <summary>CMD.exe user? It's dangerous to go alone! Take this.</summary> Surely, there's a simpler way to do it, this is adapted from my own script. ```cmd prompt $e]133;D$e\$e]133;A$e\$e\$e]9;9;$P$e\$e[30;107m[$T]$e[97;46m$g$P$e[36;49m$g$e[0m$e[K$_$e[0m$e[94m%username%$e[0m@$e[32m%computername%$e[0m$G$e]133;B$e\ ``` </details>
claunia added the pull-request label 2026-01-31 09:39:38 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#30261