commit 73471314a16c35385f57154e2ae7d943b94774d0 parent 7c0d47b0ca364408f25c0f31aaa8b937b84f113e Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Fri, 1 Jun 2018 12:34:23 -0400 Hide username from prompt if "ad" and replace prompt $ with N in normal mode Diffstat:
M | links/.zshrc | | | 10 | ++++++---- |
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/links/.zshrc b/links/.zshrc @@ -162,19 +162,21 @@ prompt_with_vimode() { echo -ne '\n' echo -n '%(1j.%{$fg[yellow]%}%jbg %{$reset_color%}.)' # background jobs echo -n "$1" - echo -n '%(!.%{$fg_bold[red]%}#.%{$fg[green]%}$)%{$reset_color%}' # su/norm + [ "$1" == "" ] && # show prompt symbol if no insert/normal mode is passed + echo -n '%(!.%{$fg_bold[red]%}#.%{$fg[green]%}$)%{$reset_color%}' echo -n '%{$reset_color%} ' } insert_mode='' -normal_mode='%{$fg[white]%}N' +normal_mode='%{$fg_bold[white]%}N' # white and bold N rprompt() { echo -n "%(?..%{$fg[red]%}[%?]%{$reset_color%})" # return status echo -n "%{$fg[green]%}${EXECTIME}%{$reset_color%} " # runtime of prev cmd echo -n "%B%{$fg[cyan]%}%~%{$reset_color%} " # pwd - echo -n "%{$fg[cyan]%}$(git_branch)" # git branch - echo -n "%{$reset_color%}%n@%m" # user and hostname + echo -n "%{$fg[cyan]%}$(git_branch)%{$reset_color%}" # git branch + [ "$USER" != "ad" ] && echo -n "%n@" #username + echo -n "%m" # hostname } PROMPT=$(prompt_with_vimode $insert_mode)