Agnoster theme is a pretty good theme for my zsh terminal. However, the hostname is too long nearly over a half of the screen. I have found a way to reduce the length and show username without hostname. it’s very easy, just to remove the @%m
to in the theme file.
1. Open the theme file.
~/.oh-my-zsh/themes/agnoster.zsh-theme
2. Search prompt_context
.
# Context: user@hostname (who am I and where am I)
prompt_context() {
if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
prompt_segment black default "%(!.%{%F{yellow}%}.)$USER@%m"
fi
}
3. Remove @%m
after $USER
, then save it.
# Context: user@hostname (who am I and where am I)
prompt_context() {
if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
prompt_segment black default "%(!.%{%F{yellow}%}.)$USER"
fi
}
And That’s it!
No comments:
Post a Comment