initial checkin
[zsh-lovers.git] / zsh_people / bruno_bonfils / rc.os / Linux.zsh
1 alias ls='ls --color'
2
3 # prompt, colors are defined in host resource file
4 autoload -U colors
5 colors
6
7 # Format
8 date_format="%H:%M"
9
10 date="%{$fg[$date_color]%}%D{$date_format}"
11 host="%{$fg[$host_color]%}%n%{$reset_color%}~%{$fg[$domain_color]%}%m"
12 cpath="%B%{$fg[$path_color]%}%/%b"
13 end="%{$reset_color%}"
14
15 # permit parameter expansion, command substitution and arithmetic expansion 
16 # in prompt
17 setopt prompt_subst
18
19 precmd () { 
20         local buffer load
21         load=(${$(< /proc/loadavg)})
22         LOADAVG="$load[1] $load[2]"
23         buffer=(${$(free)})
24         MEM="$((100 * $buffer[16] / $buffer[8]))%%"
25         if [[ $buffer[19] != 0 ]]; then
26                 MEM="$MEM $((100 * $buffer[20] / $buffer[19]))%%"
27         fi
28 }
29
30 stats="%{$fg[$status_color]%}[\$LOADAVG - \$MEM]"
31
32 PS1="$date ($host$end) $cpath
33 $end%% "
34
35 RPS1="$stats%{$reset_color%}"
36
37 export PS1 RPS1
38
39 # function use to toggle RPS1 (which is very ugly for copy/paste)
40 function rmrps1 () {
41         RPS1=""
42 }
43
44 function rps1 () {
45         RPS1="$stats%{$reset_color%}"
46 }
47
48 # zstyle OS specific
49 eval `dircolors $HOME/.zsh/misc/dircolors.rc`
50
51 # Use LS_COLORS for color completion
52 zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}