shell/zsh: show user@host on prompt in ssh

This commit is contained in:
Henrik Lissner 2017-01-08 20:29:49 -05:00
parent 607249189f
commit e93838eab4

View file

@ -64,8 +64,9 @@ prompt_init() {
zstyle ':vcs_info:git*' formats ':%b' zstyle ':vcs_info:git*' formats ':%b'
zstyle ':vcs_info:git*' actionformats ':%b (%a)' zstyle ':vcs_info:git*' actionformats ':%b (%a)'
# show username@host if logged in through SSH OR logged in as root # show username@host if logged in through SSH
is-ssh || is-root && prompt_username='%F{magenta}%n%F{244}@%m ' prompt_username=
is-ssh && prompt_username='%F{magenta}%n%F{244}@%m '
## Vim cursors ## Vim cursors
if [[ "$SSH_CONNECTION" ]]; then if [[ "$SSH_CONNECTION" ]]; then
@ -77,7 +78,7 @@ prompt_init() {
fi fi
RPROMPT='%F{cyan}${vcs_info_msg_0_}$(prompt_git_dirty)%f' RPROMPT='%F{cyan}${vcs_info_msg_0_}$(prompt_git_dirty)%f'
PROMPT='%F{cyan}%~ %f${PROMPT_SYMBOL:-$ }%f' PROMPT='${prompt_username}%F{cyan}%~ %f${PROMPT_SYMBOL:-$ }%f'
} }
prompt_init "$@" prompt_init "$@"