Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 35 additions & 28 deletions TerminalDocs/tutorials/shell-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,33 +58,40 @@ Supporting these features requires cooperation between your shell and the Termin
To enable these features in the Terminal, you'll want to add the following to your settings:

```json
"profiles":
{
"defaults":
{
// Enable marks on the scrollbar
"showMarksOnScrollbar": true,

// Needed for both pwsh, CMD and bash shell integration
"autoMarkPrompts": true,

// Add support for a right-click context menu
// You can also just bind the `showContextMenu` action
"experimental.rightClickContextMenu": true,
},
}
"actions":
[
// Scroll between prompts
{ "keys": "ctrl+up", "command": { "action": "scrollToMark", "direction": "previous" }, },
{ "keys": "ctrl+down", "command": { "action": "scrollToMark", "direction": "next" }, },

// Add the ability to select a whole command (or its output)
{ "command": { "action": "selectOutput", "direction": "prev" }, },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, this one's actually our bad! These commands definitely do exist if bound, they just aren't in the actions list by default.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha I mis-assumed since my editor was complaining about them being invalid values, I've added them back into the docs. Is it worth making a PR to add them into the schema json or is there a reason they've been left out in the meantime?

{ "command": { "action": "selectOutput", "direction": "next" }, },

{ "command": { "action": "selectCommand", "direction": "prev" }, },
{ "command": { "action": "selectCommand", "direction": "next" }, },
"profiles": {
"defaults": {
// Enable marks on the scrollbar
"showMarksOnScrollbar": true,

// Needed for both pwsh, CMD and bash shell integration
"autoMarkPrompts": true,

// Add support for a right-click context menu
// You can also just bind the `showContextMenu` action
"experimental.rightClickContextMenu": true,
},
},
"actions": [
// Create actions for scrolling to previous/next mark
{ "command": { "action": "scrollToMark", "direction": "previous" }, "id": "Terminal.ScrollToPreviousMark" },
{ "command": { "action": "scrollToMark", "direction": "next" }, "id": "Terminal.ScrollToNextMark" },
// Create actions for selecting command(s) at previous/next mark(s)
{ "command": { "action": "selectCommand", "direction": "prev" }, "id": "Terminal.SelectPrevCommand" },
{ "command": { "action": "selectCommand", "direction": "next" }, "id": "Terminal.SelectNextCommand" },
// Create actions for selecting output(s) from previous/next command(s)
{ "command": { "action": "selectOutput", "direction": "prev" }, "id": "Terminal.SelectPrevOutput" },
{ "command": { "action": "selectOutput", "direction": "next" }, "id": "Terminal.SelectNextOutput" },
],
"keybindings": [
// Define hotkeys/shortcuts for these actions by referencing the prior (user-)assigned IDs
{ "id": "Terminal.ScrollToPreviousMark", "keys": "ctrl+up" },
{ "id": "Terminal.ScrollToNextMark", "keys": "ctrl+down" },

{ "id": "Terminal.SelectPrevCommand", "keys": "ctrl+alt+shift+up" },
{ "id": "Terminal.SelectNextCommand", "keys": "ctrl+alt+shift+down" },

{ "id": "Terminal.SelectPrevOutput", "keys": "ctrl+shift+up" },
{ "id": "Terminal.SelectNextOutput", "keys": "ctrl+shift+down" }
]
```

Expand Down Expand Up @@ -183,7 +190,7 @@ function prompt {
$loc = $($executionContext.SessionState.Path.CurrentLocation);
$out += "`e]133;A$([char]07)";
$out += "`e]9;9;`"$loc`"$([char]07)";

$out += $Global:__OriginalPrompt.Invoke(); # <-- This line adds the original prompt back

$out += "`e]133;B$([char]07)";
Expand Down