feat: add Set Prompt setting for prompt symbol#710
Draft
MattieTK wants to merge 3 commits intocharmbracelet:mainfrom
Draft
feat: add Set Prompt setting for prompt symbol#710MattieTK wants to merge 3 commits intocharmbracelet:mainfrom
MattieTK wants to merge 3 commits intocharmbracelet:mainfrom
Conversation
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>
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extends the
ShellConfigfunction introduced in #709 to also accept a prompt symbol parameter, allowing users to change the prompt from>to any string.Set Promptsetting across all 9 shells (bash, zsh, fish, powershell, pwsh, cmd.exe, nushell, osh, xonsh)>(no change to current behaviour)Example usage
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:
@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:The
ShellConfig()refactor in #709 made this a small change – adding a third parameter rather than duplicating shell-specific logic.Depends on
Test plan
TestShellConfigCustomPromptverifies all 9 shells embed a custom symbol (λ)TestShellConfigReturnsNonNil,TestShellConfigCustomColor,TestShellConfigDefaultColorupdated for new signaturego test ./...)Note
This PR was authored with AI assistance (Claude Code).