add support for cygwin, killall needs work on some systems. standardized some format stuff, makes things work on cygwin (WATCHFMT, et al.)

This commit is contained in:
David Alexander Majnemer 2008-11-25 18:09:02 -06:00
parent 3db83fd73f
commit d7e92471ff

27
zshrc
View file

@ -87,7 +87,7 @@ export LESS=' -R'
alias cd..='cd ..'
case `uname -s` in
Linux)
Linux|CYGWIN_NT-5.1)
alias ls="ls -h --color=auto"
alias grep='grep -d skip --color=auto'
;;
@ -178,6 +178,10 @@ case $TERM in
bindkey '^[[C' emacs-forward-word
bindkey '^[[D' emacs-backward-word
;;
cygwin)
bindkey '^[[1~' beginning-of-line
bindkey '^[[4~' end-of-line
;;
esac
# prompt
@ -283,9 +287,9 @@ zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path "${HOME}/.zsh/.${HOST}-cache"
# descriptions
zstyle ':completion:*:messages' format $'\e[01;35m -- %d -- \e[00;00m'
zstyle ':completion:*:warnings' format $'\e[01;31m -- No Matches Found -- \e[00;00m'
zstyle ':completion:*:descriptions' format $'\e[01;33m -- %d -- \e[00;00m'
zstyle ':completion:*:messages' format $'%{\e[01;35m%} -- %d -- %{\e[00;00m%}'
zstyle ':completion:*:warnings' format $'%{\e[01;31m%} -- No Matches Found -- %{\e[00;00m%}'
zstyle ':completion:*:descriptions' format $'%{\e[01;33m%} -- %d -- %{\e[00;00m%}'
# job numbers
zstyle ':completion:*:jobs' numbers true
@ -305,12 +309,15 @@ case `uname -s` in
zstyle ':completion:*:processes-names' command 'ps -e -o args | awk "NR != 1"'
;;
Darwin)
if [ "$(sw_vers -productVersion | cut -f2 -d'.')" -ge "4" ] ; then
if [ "$(sw_vers -productVersion | cut -f2 -d'.')" -gt "4" ] ; then
zstyle ':completion:*:processes-names' command 'ps -e -o command | awk "NR != 1"'
else
zstyle ':completion:*:processes-names' command 'ps -A -o command | awk "NR != 1"'
fi
;;
CYGWIN_NT-5.1)
zstyle ':completion:*:processes-names' command 'ps -u '${USERNAME}' -s | awk "NR != 1"'
;;
esac
case `uname -s` in
@ -320,6 +327,9 @@ case `uname -s` in
Interix)
zstyle ':completion:*:*:kill:*:processes' command 'ps -i -U '${USERNAME}' -o pid,args | sed "/ps -i -U '${USERNAME}' -o pid,args/d"'
;;
CYGWIN_NT-5.1)
zstyle ':completion:*:*:kill:*:processes' command 'ps -u '${USERNAME}' -s | sed "/ps -u '${USERNAME}' -s/d"'
;;
SunOS|FreeBSD|OpenBSD)
zstyle ':completion:*:*:kill:*:processes' command 'ps -U '${USERNAME}' -o pid,args | sed "/ps -U '${USERNAME}' -o pid,args/d"'
;;
@ -332,8 +342,11 @@ case `uname -s` in
Interix|SunOS|FreeBSD|Linux)
zstyle ':completion:*:*:killall:*:processes-names' command "ps -U '${USERNAME}' -o comm"
;;
CYGWIN_NT-5.1)
zstyle ':completion:*:*:killall:*:processes-names' command "ps -u '${USERNAME}' -s"
;;
Darwin)
if [ "$(sw_vers -productVersion | cut -f2 -d'.')" -ge "4" ] ; then
if [ "$(sw_vers -productVersion | cut -f2 -d'.')" -gt "4" ] ; then
zstyle ':completion:*:*:killall:*:processes-names' command "ps -U '${USERNAME}' -o comm"
else
zstyle ':completion:*:*:killall:*:processes-names' command "ps -U '${USERNAME}' -o command"
@ -359,7 +372,7 @@ zstyle ':completion:*:diff:*' ignore-line yes
# Keep track of other people accessing the box
watch=( all )
export LOGCHECK=30
export WATCHFMT=$'\e[01;36m'" -- %n@%m has %(a.Logged In.Logged out) --"$'\e[00;00m'
export WATCHFMT=$'%{\e[01;36m%}'" -- %n@%m has %(a.Logged In.Logged out) --"$'%{\e[00;00m%}'
# directory hashes
if [[ -d "${HOME}/sandbox" ]] ; then