Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Sun, 1 Sep 2002 11:20:22 +0300 From: Ville Herva To: "Peter A. Castro" Cc: cygwin AT cygwin DOT com Subject: Re: Soliciting profiles for next Zsh release Message-ID: <20020901082022.GM3568@niksula.cs.hut.fi> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.25i On Mon, Aug 26, 2002 at 10:10:56PM -0700, you [Peter A. Castro] wrote: > Hi All, > Well, it's about time to release a new Z-Shell with *Bigger* *Bolder* > *Brighter Colors* and a *Shine You Can See Yourself In*! ... :-D > (Ok, so I haven't had enough sleep...) > > Anyhoo, before I release the new version I'd like to get some input from > users. Specifically, I'd like to see what you've done for your > /etc/zprofile, or if you've made any mods to /etc/profile or added a zsh > specific script to /etc/profile.d that you think would benefit everyone. > After the last round of "profile" goings on, I though I'd try any add > some pre-canned startup profiles (and skeletons) to make zsh the best > shell ever on Cygwin! I might even through in a desktop icon. But > rather than write this stuff in a vacuum, I'd really like to know just > what others find useful to setup so that they won't have to re-code their > precious profiles after updating the package. I really appreciate your efforts. zsh is simply the best things since sliced bread. Here are things extracted from my .zshrc (I'm lazy enough to slice generalish stuff to zprofile on the machines I use). ------------------------------------------------------------------------- tty -s stty cs8 -istrip -parenb bindkey '\e[A' up-line-or-history bindkey '\e[B' down-line-or-history bindkey '\e[C' forward-char bindkey '\e[D' backward-char bindkey '\eOA' up-line-or-history bindkey '\eOB' down-line-or-history bindkey '\eOC' forward-char bindkey '\eOD' backward-char bindkey '^[h' backward-delete-word bindkey '^@' forward-word # these may make sense for cygwin users? alias dir=ls alias type=less alias copy=cp alias del=rm alias cd..='cd ..' alias ..='cd ..' # Common aliases export PAGER=/usr/bin/less alias f='finger' alias j='jobs' alias l='ls -FA --color=tty' # different usable ls(1) aliases alias ll='ls -F --color=tty' alias lt='ls -aFt' alias L='ls -lFA --color=tty' alias LL='ls -lF --color=tty' alias LT='ls -latF' alias env='printenv' alias die='kill -9' alias m='less' alias mx='less -X' zless() { zcat $* | $PAGER; } # set rxvt title precmd() { export ZSH=`basename $SHELL` [[ -t 1 ]] || return case $TERM in sun-cmd) print -Pn "\e]l%~\e\\" ;; xterm-color) print -Pn "\e]2;%n@%m:%/ - [$ZSH]\a" ;; xterm) print -Pn "\e]2;%n@%m:%/ - [$ZSH]\a" ;; esac } export ZSH=`basename $SHELL` print -Pn "\e]2;%n@%m:%/ - [$ZSH]\a" export prompt="%B%n%b@%U%m:%/%u>" ############################################################# # helpers # I use bk (short for backwards) extensively, at least as much as # back button in browsers alias bk=popd # this I use extensively function calc () { perl -e "print \"$* = \\n\", ($*), \"\n\"" } # helper to try C one liners function c-exec { FNAME=/tmp/qwekke-$$ echo $* > $FNAME.c && gcc -o $FNAME $FNAME.c && $FNAME echo --- Exit value was $?. rm -f $FNAME.c $FNAME } function mcd { mkdir "$@"; cd "$@" } # perhaps someone has better one? I don't stand the light blue/light green # default scheme though export LS_COLORS='no=00:fi=00:di=01;34:ln=04;35:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=01;16:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.sh=01;32:*.csh=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35:' watch=notme ########################################################### # cygwin stuff # use ="cd /cygdrive/$i" is you haven't bound /c to C: like I foreach i in a b c d e f g h i j k l m n o p q r s t u v w x y z; do alias $i:="cd /$i" done alias expl='EXPLORER /e,/idlist' function start { CMD /c `cygpath -w "$1"` } compctl -g '*(/)' cd pushd popd compctl -g '*.zip' pkzip pkunzip compctl -g '*.mak' nmake compctl -g '*.hlp' winhlp32 compctl -l '' which where pidof() { echo `ps -W | grep -i $1 | gawk '{print $1}'` } psall() { ps -lW | grep -i $1 } ############################################################# # completition stuff copied from somewhere compctl -g '*.(tgz|gz)' -x \ 's[--]' -k '(stdout to-stdout decompress uncompress force help list license no-name quiet recurse suffix test verbose version fast best)' - \ 's[-S][--suffix]' -X '' - \ 's[-]' -k "(c d f h l L n q r S t v V 1 2 3 4 5 6 7 8 9 -)" -\ 's[-d][--(de|un)compress]' -g '*.{gz,Z,z,zip,taz,tgz}' - \ -- gzip compctl -g '*.(tgz|gz)' -x \ 's[-S][--suffix]' -X '' - \ 's[-d][--(de|un)compress]' -g '*.{gz,Z,z,zip,taz,tgz}' - \ 's[-]' -k "(c d f h l L n q r S t v V -)" -\ 's[--]' -k '(stdout to-stdout force help list license no-name quiet recurse suffix test verbose version )' - \ -- gunzip compctl -k '(accounts computer config continue file group help helpmsg localgroup name pause print send session share start statistics stop time use user view)' -x \ 'c[-1,config]' -k '(server workstation)' - \ 'n[-1,/user:]' -k '(domain1\\amold domain2\\amold)' -\ 'c[-1,help]' -k '(accounts computer config continue file group help help msg localgroup name pause print send session share start statistics stop time use user view) ' -\ 'c[-1,view]' -k servers -\ 'c[-1,use]' -P "\* " -k shares -\ 'c[-1,\\*]' -k shares -\ -- net if [ $NTZSH ]; then compctl -g '*.(c|cpp)' -x \ 'n[1,-O]' -k '(1 2 a b d g i p s t w x y)' -\ 'n[1,-G]' -k '(3 4 5 B d r z e s f y h X)' - \ 'n[1,-F]' -k '(a A d e m o p r R)' - \ 'n[1,-Z]' -k '(i 7 d p a e g l z)' - \ 'n[1,-M]' -k '(T D L)' - \ 'n[1,-]' -k (O G F C D E P U u I X v Z \? c H J nologo T V w W Y M L link) -\ 'c[-1,-link]' -s ' s -1 d:/lang/msdev/lib' -\ -- cl fi compctl -f -x\ 's[--]' -k '(backup force interactive update verbose suffix version-control help version)' -\ 's[-S][--suffix]' -X '' -\ 's[-V][--version-control]' -k '(t numbered nil existing never simple)' - \ 's[-]' -k '(b f i u v S V -)' -\ -- mv # n/-/f/ N/-/d/ p/1/f/ p/2/d/ n/*/f/ compctl -f -x\ 's[--]' -k '(archive backup no-dereference force interactive link preserve symbolic-link update verbose parents one-file-system recursive suffix version-control help version)' -\ 's[-]' -k '(a b d f i l p r s u v x P R S V -)' -\ 's[-*r]' -g '*(/)' -\ 's[-S][--suffix]' -X '' -\ 's[-V][--version-control]' -k '(t numbered nil existing never simple)' -\ -- cp autoload -U compinit compinit zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' # personal preference mount -b --change-cygdrive-prefix / # xfree stuff if [ "$XFREE86" != "yes" ]; then export DISPLAY=localhost:0.0 fi ------------------------------------------------------------------------- Not all of that is applicable (or clean enough) to generic distribution but I hope it gives you some ideas. Then I use this in a shortcut key: "C:\cygwin\bin\cygrun.exe /home/vherva/script/zsh-run" and zsh-run is: ------------------------------------------------------------------------- #!/bin/sh DIR="`cat /dev/clipboard`" cd "$DIR" HOME=/home/vherva TERM=rxvt \ /bin/rxvt.exe -sl 2000 -fn "Lucida Console-11" \ -bg \#ffffe9 -fg \#000000 -cr \#777700 -geometry 80x70 -e /bin/zsh ------------------------------------------------------------------------- So it jumps to the directory I have copied to clipboard (if any). I've bound it to a HP multimedia keyboard additional key and there's an option to not use "restore existing instance". Is that btw at all possible with the windows ctrl-alt-shortcuts? (Off topic, but I also have explorer and browser shortcuts: www-run -------------------------------------------------------------------------- #!/bin/sh URL="`cat /dev/clipboard | egrep '^(ftp|http|nntp)'`" /e/program\ files/opera6/opera.exe "$URL" -------------------------------------------------------------------------- explorer-run -------------------------------------------------------------------------- #!/bin/sh URL="`cat /dev/clipboard | egrep '^(ftp|http|nntp)'`" DIR="`cat /dev/clipboard`" ARG=$URL SWITCH=/n if [ "$URL" == "" ]; then DIR="`cygpath -w -s "$DIR"`" if [ ! -d "$DIR" ]; then SEL=",/select"; fi ARG="/e$SEL,$DIR" cd "$DIR" fi explorer "$ARG" -------------------------------------------------------------------------- these are really useful eg. when reading mail in rxvt and encountering an URL or \\share\dir\foo.) Then there is the explorer "zsh prompt here" dir context menu entry. I think better versions than the one I use (hacked up from old nt powertoy command prompt here .reg) have been posted to cygwin ml, but here's mine anyway (I should REALLY clean it up, but it works...): zshhere.inf -------------------------------------------------------------------------- [HKEY_CLASSES_ROOT\Directory\shell\ZshHere] @="Zsh &Prompt Here" "EditFlags"=hex:01,00,00,00 [HKEY_CLASSES_ROOT\Directory\shell\ZshHere\command] @="c:\\script\\zshhere.cmd \"%1\"" [HKEY_CLASSES_ROOT\Drive\shell\ZshHere] @="Zsh &Prompt Here" "EditFlags"=hex:01,00,00,00 [HKEY_CLASSES_ROOT\Drive\shell\ZshHere\command] @="c:\\script\\zshhere.cmd \"%1\"" -------------------------------------------------------------------------- zshhere.cmd -------------------------------------------------------------------------- @echo off echo %1> c:\tmp\cd cmd.exe /c start /min C:\cygwin\bin\sh.exe -c '. /script/cd; HOME=/home/vherva TERM=rxvt /bin/rxvt -sl 2000 -fn "Lucida Console-11" -bg \#ffffe9 -fg \#000000 -geometry 80x70 -e /bin/zsh' -------------------------------------------------------------------------- /script/cd -------------------------------------------------------------------------- # should use cygpath (but I think I wrote this before cygpath appeared) /bin/tr '\\' / < /c/tmp/cd |/bin/tr -d \"'\n\r' > /c/tmp/cd2 cd "`/bin/cat /c/tmp/cd2`" /bin/rm /c/tmp/cd /c/tmp/cd2 -------------------------------------------------------------------------- -- v -- v AT iki DOT fi -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/