# HG changeset patch # User Pascal Bellard # Date 1223564442 0 # Node ID 5a629c6af8c337aaa44798822037368d567892fd # Parent 7a43790dff5fdbe5cccb34d0cd0df78203edbcc3 Add zsh (from Sandeep Srinivasa) diff -r 7a43790dff5f -r 5a629c6af8c3 zsh/receipt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/zsh/receipt Thu Oct 09 15:00:42 2008 +0000 @@ -0,0 +1,71 @@ +# SliTaz package receipt. + +PACKAGE="zsh" +VERSION="4.3.6" +CATEGORY="system-tools" +DEPENDS="ncurses zlib" +BUILD_DEPENDS="ncurses-dev zlib-dev" +SHORT_DESC="Zsh shell incorporates many features of bash, ksh, and tcsh" +MAINTAINER="sandys@gmail.com" +TARBALL="$PACKAGE-$VERSION.tar.bz2" +WEB_SITE="http://zsh.sourceforge.net/" +WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL" + +# Rules to configure and make the package. +compile_rules() +{ + cd $src + ./configure --prefix=/usr --bindir=/bin \ + --disable-dynamic --enable-multibyte \ + --infodir=/usr/share/info --mandir=/usr/share/man \ + --enable-fndir=/usr/share/zsh/functions \ + --enable-scriptdir=/usr/share/zsh/scripts \ + $CONFIGURE_ARGS && + make && + make DESTDIR=$PWD/_pkg install +} + +# Rules to gen a SliTaz package suitable for Tazpkg. +genpkg_rules() +{ + cp -a $_pkg/bin $fs + strip -s $fs/bin/zsh + + # Config files. + # + mkdir $fs/etc + cp stuff/example.zshrc $fs/etc/zshrc + + #no way around this... gen_package will not automatically copy these + mkdir -p $fs/usr/share/zsh + cp -r $_pkg/usr/share/zsh/functions $fs/usr/share/zsh + + mkdir -p $fs/usr/share/zsh/scripts + +} + +# Post install commands for Tazpkg. +# Check /bin/sh stat. +# +post_install() +{ + local root + root=$1 + echo "Processing post-install commands..." + sh=`readlink $root/bin/sh` + if [ ! "$sh" = "/bin/zsh" ]; then + echo "" + echo "**** Actual SH link : $sh" + echo "" + echo -n "Do you want Zsh for /bin/sh (y/N) ? : "; read anser + if [ "$anser" == "y" ]; then + echo "" + echo -n "Removin sh link to make a new one pointing on /bin/zsh..." + rm $root/bin/sh && ln -s /bin/zsh $root/bin/sh + status + else + echo "" + echo "Leaving /bin/sh to : $sh" + fi + fi +} diff -r 7a43790dff5f -r 5a629c6af8c3 zsh/stuff/example.zshrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/zsh/stuff/example.zshrc Thu Oct 09 15:00:42 2008 +0000 @@ -0,0 +1,113 @@ +# history +HISTFILE=~/.zsh_history +HISTSIZE=5000 +SAVEHIST=1000 +setopt appendhistory autocd extendedglob +setopt EXTENDED_HISTORY # puts timestamps in the history + +# default apps + (( ${+BROWSER} )) || export BROWSER="w3m" + (( ${+PAGER} )) || export PAGER="less" + +BLACK="%{"$'\033[01;30m'"%}" +GREEN="%{"$'\033[01;32m'"%}" +RED="%{"$'\033[01;31m'"%}" +YELLOW="%{"$'\033[01;33m'"%}" +BLUE="%{"$'\033[01;34m'"%}" +BOLD="%{"$'\033[01;39m'"%}" +NORM="%{"$'\033[00m'"%}" + + +# prompt (if running screen, show window #) +if [ x$WINDOW != x ]; then + export PS1="$WINDOW:%~%# " +else + export PS1="[${RED}%n${YELLOW}@${BLUE}%U%m%u$:${GREEN}%2c${NORM}]%(!.#.$) " + #right prompt - time/date stamp + export RPS1="${GREEN}(%D{%m-%d %H:%M})${NORM}" +fi + +# format titles for screen and rxvt +function title() { + # escape '%' chars in $1, make nonprintables visible + a=${(V)1//\%/\%\%} + + # Truncate command, and join lines. + a=$(print -Pn "%40>...>$a" | tr -d "\n") + + case $TERM in + screen) + print -Pn "\ek$a:$3\e\\" # screen title (in ^A") + ;; + xterm*|rxvt) + print -Pn "\e]2;$2 | $a:$3\a" # plain xterm title + ;; + esac +} + +# precmd is called just before the prompt is printed +function precmd() { + title "zsh" "$USER@%m" "%55<...<%~" +} + +# preexec is called just before any command line is executed +function preexec() { + title "$1" "$USER@%m" "%35<...<%~" +} + +# vi editing +bindkey -v + +# colorful listings +zmodload -i zsh/complist +zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} + +autoload -U compinit +compinit + +# aliases +alias mv='nocorrect mv' # no spelling correction on mv +alias cp='nocorrect cp' +alias mkdir='nocorrect mkdir' +alias j=jobs +if ls -F --color=auto >&/dev/null; then + alias ls="ls --color=auto -F" +else + alias ls="ls -F" +fi +alias ll="ls -l" +alias ..='cd ..' +alias .='pwd' + +# functions +setenv() { export $1=$2 } # csh compatibility + +#bash style ctrl-a (beginning of line) and ctrl-e (end of line) +bindkey '^a' beginning-of-line +bindkey '^e' end-of-line + +# Emulate tcsh's backward-delete-word +tcsh-backward-delete-word () { + #local WORDCHARS="${WORDCHARS:s#/#}" + local WORDCHARS='*?_[]~\!#$%^<>|`@#$%^*()+?' + zle backward-delete-word +} + +zle -N tcsh-backward-delete-word + +bindkey '\e^H' tcsh-backward-delete-word + +#if this is uncommented, it will ignore the stop-at-special-chars +#bindkey '\e^H' backward-delete-word + +#uncomment this to have a nice update script that will cause ur zshrc to update from a central location + +#selfupdate(){ +# URL="http://stuff.mit.edu/~jdong/misc/zshrc" +# echo "Updating zshrc from $URL..." +# echo "Press Ctrl+C within 5 seconds to abort..." +# sleep 5 +# cp ~/.zshrc ~/.zshrc.old +# wget $URL -O ~/.zshrc +# echo "Done; existing .zshrc saved as .zshrc.old" +#}