Skip to content

! shell command history — recall previous commands with Up/Down arrow keys #2680

@ericnewton76

Description

@ericnewton76

Describe the feature or problem you'd like to solve

When using the ! prefix to run shell commands, there's no way to recall previously typed shell commands. In a normal terminal, pressing Up/Down cycles through command history — but within the Copilot CLI prompt, Up/Down navigates the Copilot conversation history instead.

This means if you ran !git status, !npm test, etc. earlier in a session, you have to retype them from scratch each time.

Proposed solution

Maintain a separate command history for !-prefixed shell commands. Once the user types !, Up/Down arrow keys should cycle through previous ! commands rather than Copilot prompt history.

Possible behaviors:

  • After typing !: Up/Down recalls previous shell commands (most recent first)
  • On empty prompt: Up/Down continues to recall Copilot prompt history (current behavior)
  • History could optionally persist across sessions (like .bash_history)

Example prompts or workflows

  1. Type !git status → runs successfully
  2. Type !npm run build → runs successfully
  3. Type ! then press Up → populates with !npm run build
  4. Press Up again → populates with !git status
  5. Press Enter → re-runs selected command

Additional context[/+]

[+]Related: #1166 (tab completion for PATH commands after !) — in this issue, i point out that it might just be best to fork a shell immediately on ! and feed it keystrokes from the user. so the command completion history would be the shell's and any other TAB completion features are handled by the shell.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions