Dash. [Was: Re: Exporting $PS1.]

Ag. Hatzimanikas a.hatzim at gmail.com
Thu Mar 15 13:22:56 PDT 2007

On Thu, Mar 15, at 10:15 Ag. Hatzimanikas wrote:
> I will attach one ~/.zshrc and ~/.zprofile.

I need to add the attach word in the grep pattern, to cover some 
more possibilities. :)
Here the files I promised.

-------------- next part --------------
	#{{{ CREDITS 
	# Many thanks to (c) Michael Prokop <mika at grml.org> 
	# which his setup gave me the chance to explore the powerfull zsh shell.
	# Also many thanks to the wonderfull zsh community (too many to count).
	# }}}
	#{{{================================  ( ~/.zshrc ) ============================
	export ZSHDIR=$HOME/.zsh
	export READNULLCMD=${PAGER:-/usr/bin/pager}
	LESSOPEN="|/home/opt/bin/lesspipe.sh %s"; export LESSOPEN
	"$HOME/MuttMail/inbox?You have new mail in your inbox"
	"$HOME/MuttMail/personal?You have a personal mail"
	export MAILPATH
	REPORTTIME=10 # report about cpu-/system-/user-time of command if running longer than 10 secondes
	[[ -r $ZSHDIR/.zsh_aliases ]] && . $ZSHDIR/.zsh_aliases
	[[ ("$(id -gn)" = "$(id -un)" && $EUID -gt 99) ]] && umask 002 || umask 022
	watch=(notme root)                      # watch for everyone but me and root
	if (( EUID != 0 )); then
		if [[ -d $ZSHDIR/func/ ]]; then
		fpath=($ZSHDIR/func $fpath)
		autoload ${fpath[1]}/*(:t)
	#{{{================================  ( autoload ) ============================
	autoload -U checkmail            # needed for my prompt
	autoload -U colors && colors     # make ${f,b}g{,_{,no_}bold} available
	autoload -U compinit && compinit # load new completion system
	autoload -U edit-command-line    # later bound to C-z e or v in vi-cmd-mode
	autoload -U zed                  # shell editor ["zed -f function"] 
	autoload -U zmv                  # who needs mmv or rename? ["zmv '(*).lis' '\$1.txt"]
	unalias run-help
	autoload -U run-help
	autoload history-search-end
	autoload -U predict-on
	autoload -U zsh-mime-setup	#http://www.bash2zsh.com/essays/essay1_file_manager.html
	zstyle :mime: mailcap ~/.mailcap
	zstyle :mime: mime-types ~/.mime.types
	zmodload -i zsh/mathfunc
	zmodload -i zsh/complist         # e.g. menu-select widget, list-colors [color specifications]
	zmodload -a zsh/stat stat
	zmodload -a zsh/zpty zpty
	zmodload -a zsh/zprof zprof
	zmodload -ap zsh/mapfile mapfile
	#{{{================================  ( Keybindings ) ============================
	bindkey -e
	bindkey '\e[1~' beginning-of-line       # home
	bindkey '\e[4~' end-of-line             # end
	bindkey "^[[A"  up-line-or-search       # cursor up
	bindkey "^[[B"  down-line-or-search     # <ESC>-
	if [[ "$TERM" != emacs ]]; then
	[[ -z "$terminfo[kdch1]" ]] || bindkey -M emacs "$terminfo[kdch1]" delete-char
	[[ -z "$terminfo[khome]" ]] || bindkey -M emacs "$terminfo[khome]" beginning-of-line
	[[ -z "$terminfo[kend]" ]] || bindkey -M emacs "$terminfo[kend]" end-of-line
	zle -N edit-command-line && bindkey '\ee' edit-command-line
	zle -N predict-on         && zle -N predict-off && bindkey "^X^Z" predict-on && bindkey "^Z" predict-off
	bindkey '^Xk' insert-kept-result
	bindkey '^XK' expand-kept-result    # shift-K to get expansion
	bindkey "^N"      _most_recent_file
	bindkey "^[^N"    _most_accessed_file
	autoload -U history-beginning-search-menu
	zle -N history-beginning-search-menu
	bindkey '\eP' history-beginning-search-menu
	#{{{================================  ( Options ) ============================
	setopt append_history   	# append history list to the history file (important for multiple parallel zsh sessions!)
	setopt auto_cd          	# if a command is issued that can't be executed as a normal command,
	                        	# and the command is the name of a directory, perform the cd command to that directory
	setopt correct          	# try to correct the spelling if possible
	setopt extended_glob    	# in order to use #, ~ and ^ for filename generation
	                        	# grep word *~(*.gz|*.bz|*.bz2|*.zip|*.Z) ->
	                        	# -> searches for word not in compressed files
	                        	# don't forget to quote '^', '~' and '#'!
	setopt extended_history 	# save each command's beginning timestamp and the duration to the history file
	                        	# list duplicates an older one, the older command is removed from the list
	setopt histignorespace  	# remove command lines from the history list when
	                        	# the first character on the line is a space
	setopt NO_clobber       	# warning if file exists ('cat /dev/null > ~/.zshrc')
	setopt histallowclobber 	# add `|' to output redirections in the history
	setopt notify	       		# report the status of backgrounds jobs immediately
	setopt auto_pushd
	setopt pushd_ignore_dups
	setopt hash_list_all 		# Whenever a command completion is attempted, make sure \
					# the entire command path is hashed first.
	#{{{================================  (  MISC ) ==============================
	[[ -d /mnt/external/home ]] && hash -d e=/mnt/external/home
	[[ -d /home/opt/local/bin ]] && hash -d l=/home/opt/local/bin
	[[ -d /usr/share/zsh/$ZSH_VERSION/functions ]] && hash -d func=/usr/share/zsh/$ZSH_VERSION/functions
	hash -d d=/home/$USER/temp/dloads
	hash -d te=/home/$USER/temp	
	hash -d t=/tmp
	hash -d bn=/home/opt/bin
	hash -d p=/home/$USER/projects
	hash -d pa=/home/$USER/projects/system/bgsmlx/patches
	hash -d b=/home/$USER/projects/system/bgsmlx/scripts
	hash -d sr=/home/$USER/projects/system/bgsmlx/sources
	hash -d bu=/home/$USER/projects/system/bgsmlx/build_dir
	hash -d lo=/home/$USER/projects/system/bgsmlx/log_dir
	hash -d g=/home/$USER/projects/system/gsmlx
	hash -d tmp=/home/$USER/projects/tms
	hash -d tm=/home/$USER/tms/shop
	hash -d log=/var/log
	typeset -U path cdpath fpath manpath  # Remove duplicates
	#{{{================================  ( ZSTYLE ) =============================
	zstyle ':completion:*' menu select=4 list-colors "=(#b) #([0-9]#)*=$color[cyan]=$color[red]"
	#               correction              # 
	# * Ignore parent directory Useful for cd, mv and cp. Ex, cd will never select the parent directory (ie cd ../<TAB>)
	zstyle ':completion:*:(cd|mv|cp):*' ignore-parents parent pwd
	zstyle ':completion::(^approximate*):*:functions' ignored-patterns '_*'
	zstyle ':completion:*' completer _complete _correct _approximate
	zstyle ':completion:*:correct:*' insert-unambiguous true
	zstyle ':completion:*:correct:*' max-errors 2 numeric
	zstyle ':completion:*:correct:*' original true
	zstyle ':completion:*:corrections' format '%B%d (errors: %e)%b'
	zstyle ':completion:*:sudo:*' command-path /usr/sbin /sbin /bin
	zstyle ':completion:*' verbose yes
	zstyle ':completion:*:descriptions' format '%B%d%b'
	zstyle ':completion:*:messages' format '%d'
	zstyle ':completion:*:warnings' format 'No matches for: %d'
	zstyle ':completion:*' group-name ''
	#* Ignore what's already in the line With commands like `rm/kill/diff'
	#it's annoying if one gets offered the same filename again even if it is already on the command line. To avoid that:
	zstyle ':completion:*:(rm|kill|diff):*' ignore-line yes
	# When completing process IDs I normally want to fall into menu selection, too:
	# zstyle ':completion:*:*:kill:*' menu yes select
	#:but I also want to make sure that I always get the list, even if I complete 
	#on a command name prefix instead of a PID and there is only one possible completion, which is inserted right away.
	# This means that the completion system shows me the excerpt from the `ps(1)' output for verification 
	#that the inserted PID is indeed the one of the command I want to kill:
	#zstyle ':completion:*:kill:*' force-list always
	#* You may want to generalize the first part 
	zstyle ':completion:*:*:*:*:processes' menu yes select 
	zstyle ':completion:*:*:*:*:processes' force-list always
	zstyle ':completion:*:history-words' stop yes
	zstyle ':completion:*:history-words' remove-all-dups yes
	zstyle ':completion:*:history-words' list false
	zstyle ':completion:*:history-words' menu yes
	# now bind it to keys and enable completion
	zle -C insert-kept-result complete-word _generic
	zle -C expand-kept-result complete-word _generic
	zstyle ':completion:*-kept-result:*' completer _insert_kept
	zstyle ':completion:insert-kept-result:*' menu yes select
	# This line must come after "compinit" in startup:
	zle -C _expand_word complete-word _expand_word_and_keep
	# No bindkey needed, it's already ^Xe from _expand_word
	zstyle ':completion:*' insert-kept menu
	zstyle ":completion:*:*:$command:*:$tag" list-colors "=(#b)\
	=$color_number_for_letters_in_second_bracket-pair"     "..."
	#zstyle ':completion:*:*:kill:*:processes' list-colors "=(#b) #([0-9]#)*=$color[cyan]=$color[red]"
	#{{{ ================================  (  FUNCS ) ==============================
        mk() { eval ${1:-MKPWD}=\"`pwd`\"; }
	rt() { eval cd \"\$${1:-MKPWD}\";pwd; }
        man() {/usr/bin/man $* | col -b | /usr/bin/vim -R -c 'set ft=man nomod nolist nofoldenable' -c "noremap <buffer> <Space> <PageDown>" -}
	mkcd() { mkdir $1 && cd $1 }
	cd() { builtin cd "$@"; }
	cl() { cd $1 && ls } 
	extract_archive () {
	local lower temp_dir user
	#    old_dirs=( *(N/) )
	if [[ $lower == *.tar.gz || $lower == *.tgz ]]; then
	    tar zvxf $1 >|/tmp/unpacked_$user
	elif [[ $lower == *.gz ]]; then
	    gunzip $1 >|/tmp/unpacked_$user
	elif [[ $lower == *.tar.bz2 || $lower == *.tbz ]]; then
	    bunzip2 -c $1 | tar xvf - >|/tmp/unpacked_$user
	elif [[ $lower == *.bz2 ]]; then
	    bunzip2 $1 >|/tmp/unpacked_$user
	elif [[ $lower == *.zip ]]; then
	    unzip $1 >|/tmp/unpacked_$user
	elif [[ $lower == *.rar ]]; then
	    unrar e $1 >|/tmp/unpacked_$user
	elif [[ $lower == *.tar ]]; then
	    tar xvf $1 >|/tmp/unpacked_$user
	elif [[ $lower == *.lha ]]; then
	    lha e $1 >|/tmp/unpacked_$user
	print "Unknown archive type: $1"
	return 1
	# Change in to the newly created directory, and
	# list the directory contents, if there is one.
	#    current_dirs=( *(N/) )
	#   for i in {1..${#current_dirs}}; do
	#        if [[ $current_dirs[$i] != $old_dirs[$i] ]]; then
	#            cd $current_dirs[$i]
	temp_dir=`head -n 1 /tmp/unpacked_$user | sed -e 's@^\./@@g' -e 's@/.*$@@g'`
	cd $temp_dir
	alias ex=extract_archive
	compdef '_files -g "*.gz *.tgz *.bz2 *.tbz *.zip *.rar *.tar *.lha"' extract_archive
	function lrm {
        setopt localoptions glob_dots no_rm_star_silent
        cd .. || return
        rm -rf $OLDPWD/* && rmdir $OLDPWD
        [[ ! -d $OLDPWD ]] || { cd $OLDPWD && return 1 }
	source ~/.zsh/ag_prompt
# vim: set fdm=marker:
-------------- next part --------------
# Last update:Κυρ Οκτ 22 15:59:08 EEST 2006
	[[ -n "$HOSTNAME" ]] || export HOSTNAME=`hostname`
	[[ -z "$USER" ]]     && export USER=`id -un`
	[[ $LOGNAME == LOGIN ]] && LOGNAME=$(id -un)
	if (( EUID == 0 )); then export HOME=/root
	else export HOME=/home/$LOGNAME
	if (( EUID != 0 )); then [[ -d /home/opt/bin ]] && PATH=/home/opt/bin
	else [[ -d /home/opt/bin ]] && PATH=/home/opt/bin
	export PATH
	export LANG="el_GR.UTF-8"
	export LC_NUMERIC="el_GR.UTF-8"
	export LC_TIME="el_GR.UTF-8"
	export LC_MONETARY="el_GR.UTF-8"
	export LC_MESSAGES="el_GR.UTF-8"
	export LC_PAPER="el_GR.UTF-8"
	export LC_NAME="el_GR.UTF-8"
	export LC_ADDRESS="el_GR.UTF-8"
	export LC_TELEPHONE="el_GR.UTF-8"
	export LC_MEASUREMENT="el_GR.UTF-8"
	export LC_ALL="" 
	export LC_CTYPE="el_GR.UTF-8"
	export LC_COLLATE="el_GR.UTF-8"
	export CFLAGS="-O2 -march=athlon64  -pipe -fomit-frame-pointer"
	export CXXFLAGS="${CFLAGS}"
	export CHOST="i686-pc-linux-gnu"
	(( ${+VISUAL} )) || export VISUAL="vim"
	export EDITOR="vim"
	export PAGER="less"
	export LESS="-R"
        export BROWSER="elinks -remote "%s""
	export DLOG=~/temp/dloads/temp/LOG
	[[ -r /usr/share/xml/docbook/xsl-stylesheets-1.68.1/catalog.xml ]] && export \
		XML_CATALOG_FILES="/usr/share/xml/docbook/xsl-stylesheets-1.68.1/catalog.xml /etc/xml/catalog"
		#export LESSCHARSET=utf-8 

More information about the blfs-dev mailing list