]> git.donarmstrong.com Git - zsh.git/blob - .zsh/zshrc/85_prompt
add machine color
[zsh.git] / .zsh / zshrc / 85_prompt
1 # -*- mode: sh -*-
2 # -*- mode: sh -*-
3 # zshrc/80_prompt
4 #
5 # Formats the shell prompt
6 #
7 # Copyright © 1994–2008 martin f. krafft <madduck@madduck.net>
8 # Released under the terms of the Artistic Licence 2.0
9 #
10 # Source repository: git://git.madduck.net/etc/zsh.git
11 #
12 if [ -n "$SSH_CLIENT" ]; then
13     machine_color="orange"
14 else
15     machine_color="green"
16 fi;
17
18
19 PS1="%{$fg[$machine_color]%}%n@%m %{$fg[green]%}%* %{$fg[yellow]%}%25<…<%~%<<%{$reset_color%}%# "
20
21 if [ "${PS1:-}" = '%m%# ' ]; then
22   local _MIDDLE="%1v%(2v.|%B%2v%b|.)%(3v.%3v.)"
23   if is_root; then
24     _MIDDLE="%25<…<%~%<<"
25     local _PS1_HL=U
26   fi
27
28   local _MACHINE_NAME="${_PS1_HL:=B}%m%${(L)_PS1_HL}"
29   _MACHINE_NAME="$_MACHINE_NAME${debian_chroot:+/%S$debian_chroot%s}"
30
31   PS1="%(2L.+.)%${_MACHINE_NAME}:${_MIDDLE}%# "
32 fi
33
34 : ${RPS1:="#%(0?..%?,)%! [%l]"}
35
36 RPROMPT='%{$fg_no_bold[green]%}${vcs_info_msg_0_}%{$reset_color%}'
37
38 # vim:ft=zsh