Skip to content

feat: add Set Prompt setting for prompt symbol#710

Draft
MattieTK wants to merge 3 commits intocharmbracelet:mainfrom
MattieTK:feature/prompt-symbol
Draft

feat: add Set Prompt setting for prompt symbol#710
MattieTK wants to merge 3 commits intocharmbracelet:mainfrom
MattieTK:feature/prompt-symbol

Conversation

@MattieTK
Copy link
Copy Markdown

@MattieTK MattieTK commented Feb 20, 2026

Summary

Extends the ShellConfig function introduced in #709 to also accept a prompt symbol parameter, allowing users to change the prompt from > to any string.

  • Adds Set Prompt setting across all 9 shells (bash, zsh, fish, powershell, pwsh, cmd.exe, nushell, osh, xonsh)
  • Defaults to > (no change to current behaviour)

Example usage

Set Prompt "$"    # bash-style
Set Prompt "%"    # zsh-style
Set Prompt ">>>"  # Python REPL-style

Motivation

This is the second half of #419 ("How can I change Shell Prompt"). While #709 addresses the colour, the original issue was specifically about changing the prompt symbol:

"I'd like to have the chance to change the start symbol of the shell prompt, for example: λ, Σ"@kevinah95 (issue author)

"My bash prompt always starts with bash-5.0$ and I can't change it"@ocervell

"I believe we should probably add some sort of setting for the PROMPT: Set Prompt "> ""@maaslalani (maintainer)

@Delta456 volunteered to implement this and attempted it in PR #469, where Env PROMPT "〉" was used to set a full-width right angle bracket. The prompt-changing part was removed as hacky, but the need remains.

Combined with Set PromptColor (#709), this gives full control over prompt appearance:

Set PromptColor "#FF8000"
Set Prompt "$"

The ShellConfig() refactor in #709 made this a small change – adding a third parameter rather than duplicating shell-specific logic.

Depends on

Test plan

  • TestShellConfigCustomPrompt verifies all 9 shells embed a custom symbol (λ)
  • Existing TestShellConfigReturnsNonNil, TestShellConfigCustomColor, TestShellConfigDefaultColor updated for new signature
  • All tests pass (go test ./...)

Note

This PR was authored with AI assistance (Claude Code).

MattieTK and others added 3 commits December 15, 2025 13:59
Add a new Set PromptColor setting that allows users to customize
the shell prompt color via a hex value (e.g., Set PromptColor "#f6821f").

Changes:
- Add PROMPT_COLOR token to token/token.go
- Refactor shell.go to support configurable prompt colors via ShellConfig()
- Add hexToRGB() helper function for color conversion
- Update tty.go to pass prompt color to shell configuration
- Add PromptColor field to Options struct with default #5B56E0
- Add ExecuteSetPromptColor function in command.go
- Update evaluator.go to handle PromptColor before VHS starts

The prompt color is applied to all supported shells (bash, zsh, fish,
nushell, osh, xonsh, powershell, pwsh). The cmdexe shell doesn't support
color customization.
Cover hex parsing edge cases (with/without #, invalid length, empty),
ShellConfig output for all 9 shells, custom colour embedding in bash
and zsh, default colour round-trip, and unknown shell handling.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extends ShellConfig to accept a prompt parameter, allowing users to
change the prompt symbol from the default ">" to any character or string.

Example usage:
  Set Prompt "$"    # bash-style
  Set Prompt "%"    # zsh-style
  Set Prompt ">>>"  # Python REPL-style
  Set Prompt "~"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant