feat: Always display username@hostname in starship prompt#75
Merged
feat: Always display username@hostname in starship prompt#75
Conversation
Add configuration to show username and hostname in all contexts (not just SSH) for better VM identification clarity. This complements vm-infra's configurable username feature where VMs can be provisioned with different usernames and use VM names as hostnames (e.g., developer@work-vm-1, testuser@test-vm-2). Changes: - Add username section with show_always=true (yellow for users, red for root) - Add hostname section with ssh_only=false (green with @ prefix) - Update format string to include $username$hostname Result: Prompt shows "username@hostname ~/path" in all contexts Related: maxrantil/vm-infra#117
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
Configure starship to always display username and hostname (not just during SSH sessions) for better VM identification clarity.
Context
This change complements the vm-infra configurable username feature (maxrantil/vm-infra#117, PR maxrantil/vm-infra#118) where VMs are provisioned with:
developer,testuser)work-vm-1,test-vm-2)Problem: Default starship config only shows username during SSH sessions. When working with multiple VMs, it's hard to identify which VM you're in.
Solution: Always show
username@hostnamein the prompt for immediate context.Changes
starship.toml
[username]section withshow_always = true[hostname]section withssh_only = false@prefix.local)$username$hostnameResult
Before:
After:
Benefits
Multi-VM Clarity:
developer@work-vm-1vsdeveloper@work-vm-2- instantly clear which VMtestuser@test-vmvsdeveloper@prod-vm- context at a glanceSecurity:
Testing
Tested with vm-infra's
--test-dotfilesflag:Expected prompt:
testuser@test-vm ~/pathReferences
STARSHIP_CONFIG_NOTE.mdin vm-infra repoReady for review - Simple config change, well-documented, tested with vm-infra integration.