Skip to content

Shell Integration

Shell integration gives Secondary Terminal more structure than a raw terminal stream. With it enabled, the extension can track command boundaries, show success or error state in the UI, display the current working directory in each header, and keep command history ready for quick reuse.

What Shell Integration Adds

CapabilityDescription
Command statusShows success, error, or running state for the most recent command.
Working directoryDisplays the current folder in the terminal header.
Command historyTracks executed commands for fast reruns.
Command navigationLets you jump between command boundaries in the buffer.

Main Settings

SettingDefaultDescription
secondaryTerminal.enableShellIntegrationtrueEnables shell integration support.
secondaryTerminal.shellIntegration.enabledtrueEnables the VS Code shell integration bridge.
secondaryTerminal.shellIntegration.showCommandStatustrueShows command result indicators in the header.
secondaryTerminal.shellIntegration.showWorkingDirectorytrueShows the current directory in the terminal header.
secondaryTerminal.shellIntegration.commandHistorytrueTracks command history for quick reuse.

Status Indicators

When shell integration is active, the extension can tell whether a command is still running or whether it finished successfully or with an error.

StatusMeaning
RunningThe current command has not finished yet.
SuccessThe command exited cleanly.
ErrorThe command exited with a failure state.

These indicators are useful when you have several terminals open and only want to glance at which one needs attention.

Working Directory in Headers

Header directory display helps when several terminals are attached to different parts of the same repository. For example, you can keep one terminal in frontend, another in backend, and a third at the repo root without running pwd just to reorient yourself.

This works best when secondaryTerminal.shellIntegration.showWorkingDirectory stays enabled.

Scroll Between Commands

Secondary Terminal exposes command-aware navigation shortcuts that build on shell integration metadata.

ActionShortcut
Scroll to previous commandCmd+Up on macOS, Ctrl+Up on Windows/Linux
Scroll to next commandCmd+Down on macOS, Ctrl+Down on Windows/Linux
Run recent commandCmd+R on macOS, Ctrl+R on Windows/Linux

These shortcuts are especially useful in long AI-assisted or build-heavy sessions where the buffer is large and plain scrolling is too slow.

Rerunning Recent Commands

Use secondaryTerminal.runRecentCommand when you want to replay earlier commands without manually searching or copying them. This is helpful for repetitive workflows like:

  • rerunning the same test target
  • rebuilding a package after edits
  • repeating git checks during review

Decorations and Visual Feedback

Shell integration pairs well with command decorations:

SettingDefaultDescription
secondaryTerminal.decorations.enabledtrueEnables visual command decorations.
secondaryTerminal.decorations.showInGuttertrueShows indicators in the gutter.
secondaryTerminal.decorations.showInOverviewRulertrueShows indicators in the overview ruler.
secondaryTerminal.decorations.successColor"#00ff00"Color for successful commands.
secondaryTerminal.decorations.errorColor"#ff0000"Color for failed commands.
secondaryTerminal.decorations.runningColor"#ffff00"Color for running commands.

Example Configuration

json
{
  "secondaryTerminal.enableShellIntegration": true,
  "secondaryTerminal.shellIntegration.showCommandStatus": true,
  "secondaryTerminal.shellIntegration.showWorkingDirectory": true,
  "secondaryTerminal.shellIntegration.commandHistory": true,
  "secondaryTerminal.decorations.enabled": true
}

Released under the MIT License.