Skip to content

Instantly share code, notes, and snippets.

@DMeechan
Last active November 28, 2017 10:53
Show Gist options
  • Save DMeechan/24f16477e3e0724ac9b5d60e357cb704 to your computer and use it in GitHub Desktop.
Save DMeechan/24f16477e3e0724ac9b5d60e357cb704 to your computer and use it in GitHub Desktop.
Remove username@computer from Agonster ZSH Theme
# If just logged on normal user, display a short name like 'Daniel' instead of full user account name like 'dmeechan'
# But if logged in as a different user (like on SSH), display the full username@machine
prompt_context() {
if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
if [[ "$USER" == "YOUR-USER-ACCOUNT-NAME" ]]; then
USER="YOUR-DESIRED-NAME"
prompt_segment black default "%(!.%{%F{yellow}%}.)$USER"
else
prompt_segment black default "%(!.%{%F{yellow}%}.)$USER@%m"
fi
fi
}
# EXAMPLE:
# prompt_context() {
# if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
# if [[ "$USER" == "dmeechan" ]]; then
# USER="Daniel"
# prompt_segment black default "%(!.%{%F{yellow}%}.)$USER"
# else
# prompt_segment black default "%(!.%{%F{yellow}%}.)$USER@%m"
# fi
# fi
# }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment