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 ..' alias cd..='cd ..'
case `uname -s` in case `uname -s` in
Linux) Linux|CYGWIN_NT-5.1)
alias ls="ls -h --color=auto" alias ls="ls -h --color=auto"
alias grep='grep -d skip --color=auto' alias grep='grep -d skip --color=auto'
;; ;;
@ -178,6 +178,10 @@ case $TERM in
bindkey '^[[C' emacs-forward-word bindkey '^[[C' emacs-forward-word
bindkey '^[[D' emacs-backward-word bindkey '^[[D' emacs-backward-word
;; ;;
cygwin)
bindkey '^[[1~' beginning-of-line
bindkey '^[[4~' end-of-line
;;
esac esac
# prompt # prompt
@ -283,9 +287,9 @@ zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path "${HOME}/.zsh/.${HOST}-cache" zstyle ':completion:*' cache-path "${HOME}/.zsh/.${HOST}-cache"
# descriptions # descriptions
zstyle ':completion:*:messages' format $'\e[01;35m -- %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:*:warnings' format $'%{\e[01;31m%} -- No Matches Found -- %{\e[00;00m%}'
zstyle ':completion:*:descriptions' format $'\e[01;33m -- %d -- \e[00;00m' zstyle ':completion:*:descriptions' format $'%{\e[01;33m%} -- %d -- %{\e[00;00m%}'
# job numbers # job numbers
zstyle ':completion:*:jobs' numbers true 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"' zstyle ':completion:*:processes-names' command 'ps -e -o args | awk "NR != 1"'
;; ;;
Darwin) 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"' zstyle ':completion:*:processes-names' command 'ps -e -o command | awk "NR != 1"'
else else
zstyle ':completion:*:processes-names' command 'ps -A -o command | awk "NR != 1"' zstyle ':completion:*:processes-names' command 'ps -A -o command | awk "NR != 1"'
fi fi
;; ;;
CYGWIN_NT-5.1)
zstyle ':completion:*:processes-names' command 'ps -u '${USERNAME}' -s | awk "NR != 1"'
;;
esac esac
case `uname -s` in case `uname -s` in
@ -320,6 +327,9 @@ case `uname -s` in
Interix) Interix)
zstyle ':completion:*:*:kill:*:processes' command 'ps -i -U '${USERNAME}' -o pid,args | sed "/ps -i -U '${USERNAME}' -o pid,args/d"' 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) SunOS|FreeBSD|OpenBSD)
zstyle ':completion:*:*:kill:*:processes' command 'ps -U '${USERNAME}' -o pid,args | sed "/ps -U '${USERNAME}' -o pid,args/d"' 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) Interix|SunOS|FreeBSD|Linux)
zstyle ':completion:*:*:killall:*:processes-names' command "ps -U '${USERNAME}' -o comm" 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) 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" zstyle ':completion:*:*:killall:*:processes-names' command "ps -U '${USERNAME}' -o comm"
else else
zstyle ':completion:*:*:killall:*:processes-names' command "ps -U '${USERNAME}' -o command" 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 # Keep track of other people accessing the box
watch=( all ) watch=( all )
export LOGCHECK=30 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 # directory hashes
if [[ -d "${HOME}/sandbox" ]] ; then if [[ -d "${HOME}/sandbox" ]] ; then