## Fichier .zshrc by Maxime Ritter ## ## Original file by Marijan Peh ## With sugestions from: ## Bart Schaefer ## Mario Jose Medjeral ## ## This file is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ## ## Use and modify to personal taste. Copying this file without ## thought will needlessly increase zsh's memory usage and startup time. ## others can't rwx my files ## this is very paranoid :-) set to 022 if you wish umask 007 # create a .zsh directory if necessary ! if [[ ! -d $HOME/.zsh ]] then mkdir $HOME/.zsh fi ## get keys working case $TERM in linux) bindkey "^[[2~" yank bindkey "^[[3~" delete-char bindkey "^[[5~" up-line-or-history ## PageUp bindkey "^[[6~" down-line-or-history ## PageDown bindkey "^[[1~" beginning-of-line bindkey "^[[4~" end-of-line bindkey "^[e" expand-cmd-path ## C-e for expanding path of typed command bindkey "^[[A" up-line-or-search ## up arrow for back-history-search bindkey "^[[B" down-line-or-search ## down arrow for fwd-history-search bindkey " " magic-space ## do history expansion on space ;; *xterm*|rxvt|(dt|k|E)term) bindkey "^[[2~" yank bindkey "^[[3~" delete-char bindkey "^[[5~" up-line-or-history ## PageUp bindkey "^[[6~" down-line-or-history ## PageDown bindkey "^[[7~" beginning-of-line bindkey "^[[8~" end-of-line bindkey "^[e" expand-cmd-path ## C-e for expanding path of typed command bindkey "^[[A" up-line-or-search ## up arrow for back-history-search bindkey "^[[B" down-line-or-search ## down arrow for fwd-history-search bindkey " " magic-space ## do history expansion on space ;; esac ## Eterm is not recognised by most OSes if [[ $TERM = "Eterm" ]] ; then case $(uname) in Linux) ; ;; NetBSD) export TERM=xterm ;; *) export TERM=xterm-color ;; esac fi ## useful bindkey macros #bindkey -s "^Xm" 'mutt\n' ## run mutt #bindkey -s "^Xc" 'mcdrom\n' ## mount or umount cdrom ## use hard limits, except for a smaller stack and no core dumps #unlimit #limit stack 8192 #limit core 0 #limit -s ## Am I a special user ?? if (( EUID == 0 )); then priv_user="yes"; else groups | egrep "wheel|adm|staff|sys|es" > /dev/null if [[ $? == 0 ]]; then priv_user="yes"; else priv_user="no"; fi; fi; ## set path and cdpath ## think about setting path,cdpath,manpath & fpath in .zshenv path=($path /bin /usr/bin /usr/X11R6/bin) path=($path /usr/local/bin $HOME/bin) cdpath=(~ ..) ## on cd command offer dirs in home and one dir up. ## /usr/games if available on system if [[ -d /usr/games ]] ; then path=($path /usr/games) fi ## /usr/pkg/bin if available on system (NetBSD package collection) if [[ -d /usr/pkg/bin ]] ; then path=($path /usr/pkg/bin) fi ## for root and specials users, add sbin dirs to path if [[ $priv_user = "yes" ]]; then path=($path /sbin /usr/sbin /usr/local/sbin) if [[ -d /usr/pkg/sbin ]] ; then path=($path /usr/pkg/sbin) fi fi; ## aditional dir to look for function definitions fpath=($fpath ~/.zsh/functions) ## EDIT ## or comment if u don't need it. ## set manpath #manpath=(/usr/local/man /usr/share/man) ## EDIT ## #manpath=($manpath /usr/X11R6/man /usr/man /usr/lib/perl5/man) ## EDIT ## ## remove duplicate entries from path,cdpath,manpath & fpath typeset -U path cdpath manpath fpath ## The file to save the history in when an interactive shell exits. ## If unset, the history is not saved. HISTFILE=${HOME}/.zsh/history ## The maximum number of events stored in the internal history list. HISTSIZE=2000 ## The maximum number of history events to save in the history file. SAVEHIST=1000 ## maximum size of the directory stack. DIRSTACKSIZE=20 ## Loading colors autoload -U colors colors ## The interval in seconds between checks for new mail. MAILCHECK=0 # 0 pour désactiver... ## The interval in seconds between checks for login/logout activity ## using the watch parameter. LOGCHECK=60 ## The baud rate of the current connection. Used by the line editor ## update mechanism to compensate for a slow terminal by delaying ## updates until necessary. #BAUD=38400 ## to turn off set this to zero ## If nonnegative, commands whose combined user and system execution times ## (measured in seconds) are greater than this value have timing ## statistics printed for them. REPORTTIME=1 ## If set, this gives a string of characters, which can use ## all the same codes as the bindkey command as described in ## section The zsh/zle Module, that will be output to ## the terminal instead of beeping. ## This may have a visible instead of an audible effect; ## for example, the string `\e[?5h\e[?5l' on a vt100 or xterm will have ## the effect of flashing reverse video on and off (if you usually use reverse ## video, you should use the string `\e[?5l\e[?5h' instead). This takes ## precedence over the NOBEEP option. #ZBEEP='\e[?5h\e[?5l' ## The directory to search for shell startup files (.zshrc, etc), ## if not $HOME. ZDOTDIR=~/.zsh ## (( ${+*} )) = if variable is set don't set it anymore (( ${+USER} )) || export USER=$USERNAME (( ${+HOSTNAME} )) || export HOSTNAME=$HOST (( ${+EDITOR} )) || export EDITOR=edit (( ${+PAGER} )) || export PAGER=`which less` (( ${+CC} )) || export CC='gcc' ## or egcs or whatever ## compiler opt. flags !!! use this with caution !!! or dont use et all case $CPUTYPE in i686) (( ${+CFLAGS} )) || export CFLAGS='-O9 -funroll-loops -ffast-math -malign-double -mcpu=pentiumpro -march=pentiumpro -fomit-frame-pointer -fno-exceptions' ;; i586) (( ${+CFLAGS} )) || export CFLAGS='-O3 -march=pentium -mcpu=pentium -ffast-math -funroll-loops -fomit-frame-pointer -fforce-mem -fforce-addr -malign-double -fno-exceptions' ;; i486) (( ${+CFLAGS} )) || export CFLAGS='-O3 -funroll-all-loops -malign-double -mcpu=i486 -march=i486 -fomit-frame-pointer -fno-exceptions' ;; *) (( ${+CXXFLAGS} )) || export CXXFLAGS=$CFLAGS esac ## variables for BitchX (irc client) (( ${+IRCNAME} )) || export IRCNAME='Evil' (( ${+IRCNICK} )) || export IRCNICK='Evil' (( ${+IRCSERVER} )) || export IRCSERVER='irc.free.fr' ## auto logout after timeout in seconds #TMOUT=1800 ## if we are in X then disable TMOUT #case $TERM in # *xterm*|rxvt|(dt|k|E)term)|screen # unset TMOUT # ;; #esac #bindkey -v ## vi key bindings bindkey -e ## emacs key bindings ## turn on full featured completion (minimal needs: zsh3.1) if [[ "$ZSH_VERSION" == (3.1|4)* ]]; then autoload -U compinit compinit -C else print "Advanced completion system not found; ignoring zstyle settings." function zstyle { } fi ## set colors for GNU ls ; set this to right file #which dircolors > /dev/null #if [ $? -eq 0 ]; then # eval `dircolors` #else # ## dircolors not availaible, try gdircolors # which gdircolors > /dev/null # if [ $? -eq 0 ]; then # eval `gdircolors -b` # # else # ## We need LS_COLORS to be set for use by zsh # export LS_COLORS="no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=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:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.png=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:" # ## GNU ls not available, using other one. # case $(uname) in # FreeBSD) # export BLOCKSIZE=K # export CLICOLOR=enable # autoload -U is-at-least # if is-at-least 4.6 $OSTYPE ; then # # new style # LSCOLORS="dxfxBxcxbxegedabagacad" # else # # Old Style # LSCOLORS="3x5x2x3x1x464301060203" # fi # export LS_COLORS # ;; # OpenBSD|NetBSD|Darwin|SunOS) # alias ls='ls -F' # ;; # esac # fi #fi ## Color completion ## this module should be automatically loaded if u use menu selection ## but to be sure we do it here zmodload -i zsh/complist ## Someone once accused zsh of not being as complete as Emacs, because it ## lacks Tetris and an adventure game. #autoload -U tetris #zle -N tetris #bindkey "^Xt" tetris ## C-x-t to play ## This allows incremental completion of a word. ## After starting this command, a list of completion ## choices can be shown after every character you ## type, which you can delete with ^h or DEL. ## RET will accept the completion so far. ## You can hit TAB to do normal completion, ^g to ## abort back to the state when you started, and ^d to list the matches. autoload -U incremental-complete-word zle -N incremental-complete-word bindkey "^Xi" incremental-complete-word ## C-x-i ## This function allows you type a file pattern, ## and see the results of the expansion at each step. ## When you hit return, they will be inserted into the command line. autoload -U insert-files zle -N insert-files bindkey "^Xf" insert-files ## C-x-f ## This set of functions implements a sort of magic history searching. ## After predict-on, typing characters causes the editor to look backward ## in the history for the first line beginning with what you have typed so ## far. After predict-off, editing returns to normal for the line found. ## In fact, you often don't even need to use predict-off, because if the ## line doesn't match something in the history, adding a key performs ## standard completion - though editing in the middle is liable to delete ## the rest of the line. #autoload -U predict-on #zle -N predict-on #zle -N predict-off #bindkey "^X^Z" predict-on ## C-x C-z #bindkey "^Z" predict-off ## C-z ## This is a multiple move based on zsh pattern matching. To get the full ## power of it, you need a postgraduate degree in zsh. ## Read /path_to_zsh_functions/zmv for some basic examples. #autoload -U zmv ## watch for my friends ## An array (colon-separated list) of login/logout events to report. ## If it contains the single word `all', then all login/logout events ## are reported. If it contains the single word `notme', then all ## events are reported as with `all' except $USERNAME. ## An entry in this list may consist of a username, ## an `@' followed by a remote hostname, ## and a `%' followed by a line (tty). #watch=( $(<~/.zsh/friends) ) ## watch for people in $HOME/.friends file watch=(notme) ## watch for everybody but me LOGCHECK=60 ## check every ... seconds for login/logout activity ## The format of login/logout reports if the watch parameter is set. ## Default is `%n has %a %l from %m'. ## Recognizes the following escape sequences: ## %n = name of the user that logged in/out. ## %a = observed action, i.e. "logged on" or "logged off". ## %l = line (tty) the user is logged in on. ## %M = full hostname of the remote host. ## %m = hostname up to the first `.'. ## %t or %@ = time, in 12-hour, am/pm format. ## %w = date in `day-dd' format. ## %W = date in `mm/dd/yy' format. ## %D = date in `yy-mm-dd' format. WATCHFMT="$fg_bold[cyan]%n $fg[white]%a %l from $fg_bold[magenta]%M $fg[white]at $fg_bold[yellow]%t." ## don't ask me 'do you wish to see all XX possibilities' before menu selection LISTPROMPT='' ## SPROMPT - the spelling prompt SPROMPT='zsh: correct '%R' to '%r' ? ([Y]es/[N]o/[E]dit/[A]bort) ' ## functions for displaying neat stuff in *term title case $TERM in *xterm*|rxvt|(dt|k|E)term) ## display user@host and full dir in *term title precmd () { print -Pn "\033]0;%n@%m %~\007" #print -Pn "\033]0;%n@%m%# %~ %l %w :: %T\a" ## or use this } ## display user@host and name of current process in *term title preexec () { print -Pn "\033]0;%n@%m <$1> %~\007" #print -Pn "\033]0;%n@%m%# <$1> %~ %l %w :: %T\a" ## or use this } ;; esac ## aliases #### alias p='ps -fu $USER' alias v='less' alias h='history' alias tail='tail -n 40' alias la='ls -la' alias cp='cp -rf' alias rm='rm -rf' alias mkdir='nocorrect mkdir' alias man='nocorrect man' alias find='noglob find' alias l='ls' alias ll='ls -l' alias l.='ls -A' alias lsa='ls -ls .*' ## list only file beginning with "." alias lsd='ls -ld *(-/DN)' ## list only dirs alias du1='du -hs *(/)' ## du with depth 1 alias u='uptime' alias j='ps ax' alias ..='cd ..' alias cd..='cd ../..' alias cd....='cd ../../..' alias cd.....='cd ../../../..' alias cd/='cd /' ## global aliases, this is not good but it's useful alias -g L='|less' alias -g G='|grep' alias -g T='|tail' alias -g H='|head' alias -g W='|wc -l' alias -g S='|sort' alias -g US='|sort -u' alias -g NS='|sort -n' alias -g RNS='|sort -nr' alias -g N='&>/dev/null&' alias -g COL='|colorize | less -R' ## changing terminal type alias v1='export TERM=vt100' alias v2='export TERM=vt220' alias vx='export TERM=xterm-color' alias TODO='cat - | mail airmax+todo@trolleur.net -s ' ## functions #### ## csh compatibility setenv () { typeset -x "${1}${1:+=}${(@)argv[2,$#]}" } ## find process to kill and kill it. pskill () { local pid pid=$(ps -ax | grep $1 | grep -v grep | awk '{ print $1 }') echo -n "killing $1 (process $pid)..." kill -9 $=pid echo "slaughtered." } ## invoke this every time when u change .zshrc to ## recompile it. src () { autoload -U zrecompile [ -f ~/.zshrc ] && zrecompile -p ~/.zshrc [ -f ~/.zcompdump ] && zrecompile -p ~/.zcompdump [ -f ~/.zshrc.zwc.old ] && rm -f ~/.zshrc.zwc.old [ -f ~/.zcompdump.zwc.old ] && rm -f ~/.zcompdump.zwc.old source ~/.zshrc } ## make screenshot of current desktop (use import from ImageMagic) sshot () { sleep 5; import -window root desktop.jpg } ## find all suid files suidfind () { ls -l /**/*(su0x) } ## restore all .bak files restore_bak () { autoload -U zmv zmv '(**/)(*).bak' '$1$2' } ## display processes tree in less pst () { pstree -p $* | less -S } ## completions #### ## General completion technique ## complete as much u can .. zstyle ':completion:*' completer _complete _list _oldlist _expand _ignored _match _correct _approximate _prefix ## complete less #zstyle ':completion:*' completer _expand _complete _list _ignored _approximate ## complete minimal #zstyle ':completion:*' completer _complete _ignored ## allow one error #zstyle ':completion:*:approximate:*' max-errors 1 numeric ## allow one error for every three characters typed in approximate completer zstyle -e ':completion:*:approximate:*' max-errors \ 'reply=( $(( ($#PREFIX+$#SUFFIX)/3 )) numeric )' ## formatting and messages zstyle ':completion:*' verbose yes zstyle ':completion:*:descriptions' format $'%{\e[0;31m%}%d%{\e[0m%}' zstyle ':completion:*:messages' format $'%{\e[0;31m%}%d%{\e[0m%}' zstyle ':completion:*:warnings' format $'%{\e[0;31m%}No matches for: %d%{\e[0m%}' zstyle ':completion:*:corrections' format $'%{\e[0;31m%}%d (errors: %e)%{\e[0m%}' zstyle ':completion:*' group-name '' zstyle ':completion:*' file-sort name ## how many completions switch on menu selection ## use 'long' to start menu compl. if list is bigger than screen ## or some number to start menu compl. if list has that number ## of completions (or more). zstyle ':completion:*' menu select=long ## case-insensitive (uppercase from lowercase) completion zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' ## case-insensitive (all) completion #zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' ## case-insensitive,partial-word and then substring completion #zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' ## offer indexes before parameters in subscripts zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters ## insert all expansions for expand completer zstyle ':completion:*:expand:*' tag-order all-expansions ## ignore completion functions (until the _ignored completer) zstyle ':completion:*:functions' ignored-patterns '_*' ## completion caching zstyle ':completion::complete:*' use-cache 1 zstyle ':completion::complete:*' cache-path ~/.zcompcache/$HOST ## add colors to completions zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} ## don't complete backup files as executables zstyle ':completion:*:complete:-command-::commands' ignored-patterns '*\~' ## filename suffixes to ignore during completion (except after rm command) zstyle ':completion:*:*:(^rm):*:*files' ignored-patterns \ '*?.(o|c~|old|pro|zwc)' '*~' ## completions for some progs. not in default completion system zstyle ':completion:*:*:mpg123:*' file-patterns \ '*.(mp3|MP3):mp3\ files *(-/):directories' zstyle ':completion:*:*:ogg123:*' file-patterns \ '*.(ogg|OGG):ogg\ files *(-/):directories' ## generic completions for programs which understand GNU long options(--help) compdef _gnu_generic slrnpull make df du ## on processes completion complete all user processes zstyle ':completion:*:processes' command 'ps -au$USER' ## add colors to processes for kill completion zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31' ## common usernames #users=(jozo tomi peh) ## complete usernames #users=(airmax ritter root backup rmax) ## if u have too much users to write in here, use file; change ## 'users=(jozo tomi peh)' to 'users=( $(<~/.somefile) )' zstyle ':completion:*' users $users ## common hostnames hosts=( $( # Report the status of background and suspended jobs before exiting a shell # with job control; a second attempt to exit the shell will succeed. # NO_CHECK_JOBS is best used only in combination with NO_HUP, else # such jobs will be killed automatically. #setopt NO_check_jobs # CLOBBER (+C, ksh: +C) # Allows `>' redirection to truncate existing files, # and `>>' to create files. # Otherwise `>!' or `>|' must be used to truncate a file, # and `>>!' or `>>|' to create a file. #setopt clobber # COMPLETE_ALIASES # Prevents aliases on the command line from being internally substituted # before completion is attempted. The effect is to make the alias a # distinct command for completion purposes. setopt NO_complete_aliases # COMPLETE_IN_WORD # If unset, the cursor is set to the end of the word if completion is # started. Otherwise it stays there and completion is done from both ends. setopt complete_in_word # CORRECT (-0) # Try to correct the spelling of commands. setopt NO_correct # CORRECT_ALL (-O) # Try to correct the spelling of all arguments in a line. setopt correct_all # CSH_JUNKIE_HISTORY # A history reference without an event specifier will always refer to the # previous command. Without this option, such a history reference refers # to the same event as the previous history reference, defaulting to the # previous command. #setopt csh_junkie_history # CSH_JUNKIE_LOOPS # Allow loop bodies to take the form `list; end' instead of # `do list; done'. #setopt csh_junkie_loops # CSH_JUNKIE_QUOTES # Changes the rules for single- and double-quoted text to match that of # csh. These require that embedded newlines be preceded by a backslash; # unescaped newlines will cause an error message. # In double-quoted strings, it is made impossible to escape `$', ``' # or `"' (and `\' itself no longer needs escaping). # Command substitutions are only expanded once, and cannot be nested. #setopt csh_junkie_quotes # CSH_NULLCMD # Do not use the values of NULLCMD and READNULLCMD # when running redirections with no command. This make # such redirections fail (see section Redirection). #setopt csh_nullcmd # CSH_NULL_GLOB # If a pattern for filename generation has no matches, # delete the pattern from the argument list; # do not report an error unless all the patterns # in a command have no matches. # Overrides NOMATCH. #setopt csh_null_glob # DVORAK # Use the Dvorak keyboard instead of the standard qwerty keyboard as a basis # for examining spelling mistakes for the CORRECT and CORRECT_ALL # options and the spell-word editor command. #setopt dvorak # EQUALS # Perform = filename expansion. # (See section Filename Expansion.) #setopt NO_equals # ERR_EXIT (-e, ksh: -e) # If a command has a non-zero exit status, execute the ZERR # trap, if set, and exit. This is disabled while running initialization # scripts. #setopt err_exit # EXTENDED_GLOB # Treat the `#', `~' and `^' characters as part of patterns # for filename generation, etc. (An initial unquoted `~' # always produces named directory expansion.) setopt extended_glob # EXTENDED_HISTORY # Save each command's beginning timestamp (in seconds since the epoch) # and the duration (in seconds) to the history file. The format of # this prefixed data is: # `:::'. #setopt extended_history # FLOW_CONTROL # If this option is unset, # output flow control via start/stop characters (usually assigned to # ^S/^Q) is disabled in the shell's editor. #setopt NO_flow_control # FUNCTION_ARGZERO # When executing a shell function or sourcing a script, set $0 # temporarily to the name of the function/script. #setopt NO_function_argzero # GLOB (+F, ksh: +f) # Perform filename generation (globbing). # (See section Filename Generation.) #setopt NO_glob # GLOBAL_EXPORT () # If this option is set, passing the -x flag to the builtins declare, # float, integer, readonly and typeset (but not local) # will also set the -g flag; hence parameters exported to # the environment will not be made local to the enclosing function, unless # they were already or the flag +g is given explicitly. If the option is # unset, exported parameters will be made local in just the same way as any # other parameter. # This option is set by default for backward compatibility; it is not # recommended that its behaviour be relied upon. Note that the builtin # export always sets both the -x and -g flags, and hence its # effect extends beyond the scope of the enclosing function; this is the # most portable way to achieve this behaviour. #setopt NO_global_export # GLOBAL_RCS (-d) # If this option is unset, the startup files /etc/zprofile, # /etc/zshrc, /etc/zlogin and /etc/zlogout will not be run. It # can be disabled and re-enabled at any time, including inside local startup # files (.zshrc, etc.). #setopt NO_global_rcs # GLOB_ASSIGN # If this option is set, filename generation (globbing) is # performed on the right hand side of scalar parameter assignments of # the form `name=pattern (e.g. `foo=*'). # If the result has more than one word the parameter will become an array # with those words as arguments. This option is provided for backwards # compatibility only: globbing is always performed on the right hand side # of array assignments of the form `name=(value)' # (e.g. `foo=(*)') and this form is recommended for clarity; # with this option set, it is not possible to predict whether the result # will be an array or a scalar. #setopt glob_assign # GLOB_COMPLETE # When the current word has a glob pattern, do not insert all the words # resulting from the expansion but generate matches as for completion and # cycle through them like MENU_COMPLETE. The matches are generated as if # a `*' was added to the end of the word, or inserted at the cursor when # COMPLETE_IN_WORD is set. This actually uses pattern matching, not # globbing, so it works not only for files but for any completion, such as # options, user names, etc. setopt glob_complete # GLOB_DOTS (-4) # Do not require a leading `.' in a filename to be matched explicitly. #setopt glob_dots # GLOB_SUBST # Treat any characters resulting from parameter expansion as being # eligible for file expansion and filename generation, and any # characters resulting from command substitution as being eligible # for filename generation. Braces (and commas in between) do not # become eligible for expansion. #setopt glob_subst # HASH_CMDS # Note the location of each command the first time it is executed. # Subsequent invocations of the same command will use the # saved location, avoiding a path search. # If this option is unset, no path hashing is done at all. # However, when CORRECT is set, commands whose names do not appear in # the functions or aliases hash tables are hashed in order to avoid # reporting them as spelling errors. #setopt NO_hash_cmds # HASH_DIRS # Whenever a command name is hashed, hash the directory containing it, # as well as all directories that occur earlier in the path. # Has no effect if neither HASH_CMDS nor CORRECT is set. #setopt NO_hash_dirs # HASH_LIST_ALL # Whenever a command completion is attempted, make sure the entire # command path is hashed first. This makes the first completion slower. #setopt NO_hash_list_all # HIST_ALLOW_CLOBBER # Add `|' to output redirections in the history. This allows history # references to clobber files even when CLOBBER is unset. setopt NO_hist_allow_clobber # HIST_BEEP # Beep when an attempt is made to access a history entry which # isn't there. setopt NO_hist_beep # HIST_EXPIRE_DUPS_FIRST # If the internal history needs to be trimmed to add the current command line, # setting this option will cause the oldest history event that has a duplicate # to be lost before losing a unique event from the list. # You should be sure to set the value of HISTSIZE to a larger number # than SAVEHIST in order to give you some room for the duplicated # events, otherwise this option will behave just like HIST_IGNORE_ALL_DUPS # once the history fills up with unique events. setopt hist_expire_dups_first # HIST_FIND_NO_DUPS # When searching for history entries in the line editor, do not display # duplicates of a line previously found, even if the duplicates are not # contiguous. setopt hist_find_no_dups # HIST_IGNORE_ALL_DUPS # If a new command line being added to the history list duplicates an # older one, the older command is removed from the list (even if it is # not the previous event). # setopt hist_ignore_all_dups # HIST_IGNORE_DUPS (-h) # Do not enter command lines into the history list # if they are duplicates of the previous event. setopt hist_ignore_dups # HIST_IGNORE_SPACE (-g) # Remove command lines from the history list when the first character on # the line is a space, or when one of the expanded aliases contains a # leading space. # Note that the command lingers in the internal history until the next # command is entered before it vanishes, allowing you to briefly reuse # or edit the line. If you want to make it vanish right away without # entering another command, type a space and press return. # setopt hist_ignore_space # HIST_NO_FUNCTIONS # Remove function definitions from the history list. # Note that the function lingers in the internal history until the next # command is entered before it vanishes, allowing you to briefly reuse # or edit the definition. setopt hist_no_functions # HIST_NO_STORE # Remove the history (fc -l) command from the history list # when invoked. # Note that the command lingers in the internal history until the next # command is entered before it vanishes, allowing you to briefly reuse # or edit the line. # setopt hist_no_store # HIST_REDUCE_BLANKS # Remove superfluous blanks from each command line # being added to the history list. setopt hist_reduce_blanks # HIST_SAVE_NO_DUPS # When writing out the history file, older commands that duplicate # newer ones are omitted. setopt hist_save_no_dups # HIST_VERIFY # Whenever the user enters a line with history expansion, # don't execute the line directly; instead, perform # history expansion and reload the line into the editing buffer. setopt hist_verify # HUP # Send the HUP signal to running jobs when the # shell exits. setopt NO_hup # IGNORE_BRACES (-I) # Do not perform brace expansion. #setopt ignore_braces # IGNORE_EOF (-7) # Do not exit on end-of-file. Require the use # of exit or logout instead. # However, ten consecutive EOFs will cause the shell to exit anyway, # to avoid the shell hanging if its tty goes away. # Also, if this option is set and the Zsh Line Editor is used, widgets # implemented by shell functions can be bound to EOF (normally # Control-D) without printing the normal warning message. This works # only for normal widgets, not for completion widgets. #setopt ignore_eof # INC_APPEND_HISTORY # This options works like APPEND_HISTORY except that new history lines # are added to the $HISTFILE incrementally (as soon as they are # entered), rather than waiting until the shell is killed. # The file is periodically trimmed to the number of lines specified by # $SAVEHIST, but can exceed this value between trimmings. setopt inc_append_history # INTERACTIVE (-i, ksh: -i) # This is an interactive shell. This option is set upon initialisation if # the standard input is a tty and commands are being read from standard input. # (See the discussion of SHIN_STDIN.) # This heuristic may be overridden by specifying a state for this option # on the command line. # The value of this option cannot be changed anywhere other than the command line. #setopt NO_interactive # INTERACTIVE_COMMENTS (-k) # Allow comments even in interactive shells. setopt interactive_comments # KSH_ARRAYS # Emulate ksh array handling as closely as possible. If this option # is set, array elements are numbered from zero, an array parameter # without subscript refers to the first element instead of the whole array, # and braces are required to delimit a subscript (`${path[2]}' rather # than just `$path[2]'). #setopt ksh_arrays # KSH_AUTOLOAD # Emulate ksh function autoloading. This means that when a function is # autoloaded, the corresponding file is merely executed, and must define # the function itself. (By default, the function is defined to the contents # of the file. However, the most common ksh-style case - of the file # containing only a simple definition of the function - is always handled # in the ksh-compatible manner.) #setopt ksh_autoload # KSH_GLOB # In pattern matching, the interpretation of parentheses is affected by # a preceding `@', `*', `+', `?' or `!'. See section Filename Generation. #setopt ksh_glob # KSH_OPTION_PRINT # Alters the way options settings are printed: instead of separate lists of # set and unset options, all options are shown, marked `on' if # they are in the non-default state, `off' otherwise. #setopt ksh_option_print # KSH_TYPESET # Alters the way arguments to the typeset family of commands, including # declare, export, float, integer, local and # readonly, are processed. Without this option, zsh will perform normal # word splitting after command and parameter expansion in arguments of an # assignment; with it, word splitting does not take place in those cases. #setopt ksh_typeset # LIST_AMBIGUOUS # This option works when AUTO_LIST or BASH_AUTO_LIST is also # set. If there is an unambiguous prefix to insert on the command line, # that is done without a completion list being displayed; in other # words, auto-listing behaviour only takes place when nothing would be # inserted. In the case of BASH_AUTO_LIST, this means that the list # will be delayed to the third call of the function. #setopt NO_list_ambiguous # LIST_BEEP # Beep on an ambiguous completion. More accurately, this forces the # completion widgets to return status 1 on an ambiguous completion, which # causes the shell to beep if the option BEEP is also set; this may # be modified if completion is called from a user-defined widget. setopt NO_list_beep # LIST_PACKED # Try to make the completion list smaller (occupying less lines) by # printing the matches in columns with different widths. setopt list_packed # LIST_ROWS_FIRST # Lay out the matches in completion lists sorted horizontally, that is, # the second match is to the right of the first one, not under it as # usual. setopt NO_list_rows_first # LIST_TYPES (-X) # When listing files that are possible completions, show the # type of each file with a trailing identifying mark. setopt list_types # LOCAL_OPTIONS # If this option is set at the point of return from a shell function, # all the options (including this one) which were in force upon entry to # the function are restored. Otherwise, only this option and the XTRACE # and PRINT_EXIT_VALUE options are restored. Hence # if this is explicitly unset by a shell function the other options in # force at the point of return will remain so. # A shell function can also guarantee itself a known shell configuration # with a formulation like `emulate -L zsh'; the -L activates LOCAL_OPTIONS. #setopt local_options # LOCAL_TRAPS # If this option is set when a signal trap is set inside a function, then the # previous status of the trap for that signal will be restored when the # function exits. Note that this option must be set prior to altering the # trap behaviour in a function; unlike LOCAL_OPTIONS, the value on exit # from the function is irrelevant. However, it does not need to be set # before any global trap for that to be correctly restored by a function. # For example, # unsetopt localtraps # trap - INT # fn() { setopt localtraps; trap '{}' INT; sleep 3; } # will restore normally handling of SIGINT after the function exits. #setopt local_traps # LONG_LIST_JOBS (-R) # List jobs in the long format by default. setopt long_list_jobs # MAGIC_EQUAL_SUBST # All unquoted arguments of the form `anything=expression' # appearing after the command name have filename expansion (that is, # where expression has a leading `~' or `=') performed on # expression as if it were a parameter assignment. The argument is # not otherwise treated specially; it is passed to the command as a single # argument, and not used as an actual parameter assignment. # For example, in echo foo=~/bar:~/rod, both occurrences of ~ would be replaced. # Note that this happens anyway with typeset and similar statements. # This option respects the setting of the KSH_TYPESET option. # In other words, if both options are in effect, arguments looking like # assignments will not undergo wordsplitting. setopt magic_equal_subst # MAIL_WARNING (-U) # Print a warning message if a mail file has been # accessed since the shell last checked. setopt mail_warning # MARK_DIRS (-8, ksh: -X) # Append a trailing `/' to all directory # names resulting from filename generation (globbing). #setopt mark_dirs # MENU_COMPLETE (-Y) # On an ambiguous completion, instead of listing possibilities or beeping, # insert the first match immediately. Then when completion is requested # again, remove the first match and insert the second match, etc. # When there are no more matches, go back to the first one again. # reverse-menu-complete may be used to loop through the list # in the other direction. This option overrides AUTO_MENU. # setopt menu_complete # MONITOR (-m, ksh: -m) # Allow job control. Set by default in interactive shells. #setopt NO_monitor # MULTIOS # Perform implicit tees or cats when multiple # redirections are attempted (see section Redirection). #setopt NO_multios # NOMATCH (+3) # If a pattern for filename generation has no matches, # print an error, instead of # leaving it unchanged in the argument list. # This also applies to file expansion # of an initial `~' or `='. #setopt NO_nomatch # NOTIFY (-5, ksh: -b) # Report the status of background jobs immediately, rather than # waiting until just before printing a prompt. #setopt NO_notify # NULL_GLOB (-G) # If a pattern for filename generation has no matches, # delete the pattern from the argument list instead of reporting an error. # Overrides NOMATCH. setopt null_glob # NUMERIC_GLOB_SORT # If numeric filenames are matched by a filename generation pattern, # sort the filenames numerically rather than lexicographically. setopt NO_numeric_glob_sort # OCTAL_ZEROES # Interpret any integer constant beginning with a 0 as octal, per IEEE Std # 1003.2-1992 (ISO 9945-2:1993). This is not enabled by default as it # causes problems with parsing of, for example, date and time strings with # leading zeroes. #setopt octal_zeroes # OVERSTRIKE # Start up the line editor in overstrike mode. #setopt overstrike # PATH_DIRS (-Q) # Perform a path search even on command names with slashes in them. # Thus if `/usr/local/bin' is in the user's path, and he or she types # `X11/xinit', the command `/usr/local/bin/X11/xinit' will be executed # (assuming it exists). # Commands explicitly beginning with `/', `./' or `../' # are not subject to the path search. # This also applies to the . builtin. # Note that subdirectories of the current directory are always searched for # executables specified in this form. This takes place before any search # indicated by this option, and regardless of whether `.' or the current # directory appear in the command search path. setopt NO_path_dirs # POSIX_BUILTINS # When this option is set the command builtin can be used to execute # shell builtin commands. Parameter assignments specified before shell # functions and special builtins are kept after the command completes unless # the special builtin is prefixed with the command builtin. Special # builtins are # .,:,break,continue,declare,eval,exit, # export,integer,local,readonly,return,set,shift,source,times,trap and unset. #setopt posix_builtins # PRINT_EIGHT_BIT # Print eight bit characters literally in completion lists, etc. # This option is not necessary if your system correctly returns the # printability of eight bit characters (see man page ctype(3)). setopt print_eight_bit # PRINT_EXIT_VALUE (-1) # Print the exit value of programs with non-zero exit status. setopt print_exit_value # PRIVILEGED (-p, ksh: -p) # Turn on privileged mode. This is enabled automatically on startup if the # effective user (group) ID is not equal to the real user (group) ID. Turning # this option off causes the effective user and group IDs to be set to the # real user and group IDs. This option disables sourcing user startup files. # If zsh is invoked as `sh' or `ksh' with this option set, # /etc/suid_profile is sourced (after /etc/profile on interactive # shells). Sourcing ~/.profile is disabled and the contents of the # ENV variable is ignored. This option cannot be changed using the # -m option of setopt and unsetopt, and changing it inside a # function always changes it globally regardless of the LOCAL_OPTIONS # option. #setopt privileged # PROMPT_BANG # If set, `!' is treated specially in prompt expansion. # See section Prompt Expansion. #setopt prompt_bang # PROMPT_CR (+V) # Print a carriage return just before printing # a prompt in the line editor. This is on by default as multi-line editing # is only possible if the editor knows where the start of the line appears. #setopt NO_prompt_cr # PROMPT_PERCENT # If set, `%' is treated specially in prompt expansion. # See section Prompt Expansion. #setopt NO_prompt_percent # PROMPT_SUBST # If set, parameter expansion, command substitution and # arithmetic expansion are performed in prompts. #setopt prompt_subst # PUSHD_IGNORE_DUPS # Don't push multiple copies of the same directory onto the directory stack. setopt pushd_ignore_dups # PUSHD_MINUS # Exchanges the meanings of `+' and `-' # when used with a number to specify a directory in the stack. setopt pushd_minus # PUSHD_SILENT (-E) # Do not print the directory stack after pushd or popd. setopt pushd_silent # PUSHD_TO_HOME (-D) # Have pushd with no arguments act like `pushd $HOME'. #setopt NO_pushd_to_home # RC_EXPAND_PARAM (-P) # Array expansions of the form # `foo${xx}bar', where the parameter # xx is set to (a b c), are substituted with # `fooabar foobbar foocbar' instead of the default # `fooa b cbar'. #setopt rc_expand_param # RC_QUOTES # Allow the character sequence `'{'}' to signify a single quote # within singly quoted strings. Note this does not apply in quoted strings # using the format $'...', where a backslashed single quote can # be used. setopt rc_quotes # RCS (+f) # After /etc/zshenv is sourced on startup, source the # .zshenv, /etc/zprofile, .zprofile, # /etc/zshrc, .zshrc, /etc/zlogin, .zlogin, and .zlogout # files, as described in section Files. # If this option is unset, the /etc/zshenv file is still sourced, but any # of the others will not be; it can be set at any time to prevent the # remaining startup files after the currently executing one from # being sourced. #setopt NO_rcs # REC_EXACT (-S) # In completion, recognize exact matches even # if they are ambiguous. #setopt rec_exact # RESTRICTED (-r) # Enables restricted mode. This option cannot be changed using # unsetopt, and setting it inside a function always changes it # globally regardless of the LOCAL_OPTIONS option. See # section Restricted Shell. #setopt restricted # RM_STAR_SILENT (-H) # Do not query the user before executing `rm *' or `rm path/*'. #setopt rm_star_silent # RM_STAR_WAIT # If querying the user before executing `rm *' or `rm path/*', # first wait ten seconds and ignore anything typed in that time. # This avoids the problem of reflexively answering `yes' to the query # when one didn't really mean it. The wait and query can always be # avoided by expanding the `*' in ZLE (with tab). #setopt rm_star_wait # SHARE_HISTORY # This option both imports new commands from the history file, and also # causes your typed commands to be appended to the history file (the # latter is like specifying INC_APPEND_HISTORY). # The history lines are also output with timestamps ala # EXTENDED_HISTORY (which makes it easier to find the spot where # we left off reading the file after it gets re-written). # setopt share_history # SH_FILE_EXPANSION # Perform filename expansion (e.g., ~ expansion) before # parameter expansion, command substitution, arithmetic expansion # and brace expansion. # If this option is unset, it is performed after # brace expansion, so things like `~$USERNAME' and # `~{pfalstad,rc}' will work. #setopt sh_file_expansion # SH_GLOB # Disables the special meaning of `(', `|', `)' # and '<' for globbing the result of parameter and command substitutions, # and in some other places where # the shell accepts patterns. This option is set by default if zsh is # invoked as sh or ksh. #setopt sh_glob # SHIN_STDIN (-s, ksh: -s) # Commands are being read from the standard input. # Commands are read from standard input if no command is specified with # -c and no file of commands is specified. If SHIN_STDIN # is set explicitly on the command line, # any argument that would otherwise have been # taken as a file to run will instead be treated as a normal positional # parameter. # Note that setting or unsetting this option on the command line does not # necessarily affect the state the option will have while the shell is # running - that is purely an indicator of whether on not commands are # actually being read from standard input. The value of this option # cannot be changed anywhere other # than the command line. #setopt shin_stdin # SH_NULLCMD # Do not use the values of NULLCMD and READNULLCMD # when doing redirections, use `:' instead (see section Redirection). #setopt sh_nullcmd # SH_OPTION_LETTERS # If this option is set the shell tries to interpret single letter options # (which are used with set and setopt) like ksh does. # This also affects the value of the - special parameter. #setopt sh_option_letters # SHORT_LOOPS # Allow the short forms of for, select, # if, and function constructs. #setopt NO_short_loops # SH_WORD_SPLIT (-y) # Causes field splitting to be performed on unquoted parameter expansions. # Note that this option has nothing to do with word splitting. # (See section Parameter Expansion.) #setopt sh_word_split # SINGLE_COMMAND (-t, ksh: -t) # If the shell is reading from standard input, it exits after a single command # has been executed. This also makes the shell non-interactive, unless the # INTERACTIVE option is explicitly set on the command line. # The value of this option cannot be changed anywhere other than the command line. #setopt single_command # SINGLE_LINE_ZLE (-M) # Use single-line command line editing instead of multi-line. #setopt single_line_zle # SUN_KEYBOARD_HACK (-L) # If a line ends with a backquote, and there are an odd number # of backquotes on the line, ignore the trailing backquote. # This is useful on some keyboards where the return key is # too small, and the backquote key lies annoyingly close to it. #setopt sun_keyboard_hack # UNSET (+u, ksh: +u) # Treat unset parameters as if they were empty when substituting. # Otherwise they are treated as an error. #setopt NO_unset # VERBOSE (-v, ksh: -v) # Print shell input lines as they are read. #setopt verbose # XTRACE (-x, ksh: -x) # Print commands and their arguments as they are executed. #setopt xtrace # ZLE (-Z) # Use the zsh line editor. Set by default in interactive shells connected to # a terminal. #setopt NO_zle #### The prompt de la mort qui tue ##### # # Compatible avec la syntaxe de scp & autres (user@machine:chemin) # Change de couleur tout seul (a coder) : # - username : vert : user lambda # jaune : user d'un groupe privilégié # rouge : root, grosse connerie en vue. # - hostname : Bleu : EFREI # Cyan : Assos Efrei # Jaune : guinness # Rouge : sous-bock # Vert : che # Blanc : autres machines de chez moi. # Magenta : par défaut # Trouver la couleur de l'utilisateur if [[ $UID == 0 ]]; then user_color="red"; else if [[ $priv_user = "yes" ]]; then user_color="yellow" else user_color="green" fi; fi; # trouver la couleur de la machine case `hostname` in noe|ed|*(assos|linux).efrei.fr|arnoul|*.club-rezo.org) host_color="cyan" ;; *efrei.fr) host_color="blue" ;; guinness*) host_color="yellow"; ;; sous-bock*) host_color="red"; ;; che*) host_color="green"; ;; fut*) host_color="white"; ;; *) host_color="magenta"; ;; esac # define your colors here (i hate white background) path_color="magenta" date_color="yellow" arrobase_color="white" sep_color="cyan" # Format date_format="%H:%M" date="%{$fg_bold[$date_color]%}%D{$date_format}" host="%{$fg_bold[$user_color]%}%n%{$fg_no_bold[$arrobase_color]%}@%{$fg_bold[$host_color]%}%m" cpath="%B%{$fg_bold[$path_color]%}%~%b" end="%{$reset_color%}%%" # enjoy 256 colors in xterm !!! (thanks to Denis Bodor) # Note : your xterm _must_ have compiled with 256 colors support !! # This is *not* the default ! case $TERM in *xterm*|rxvt|(dt|k|E)term|*screen*) PS1="$host%{$fg_no_bold[$sep_color]%}:$cpath$end " export RPS1=" $date%{$fg[white]%}" # export RPS1=$'%{\e[48;5;233m%} %{\e[48;5;234m%} %{\e[48;5;235m%} %{\e[48;5;236m%} %{\e[48;5;237m%} %{\e[48;5;238m%} %{\e[48;5;239m%} %{\e[48;5;240m%} %{\e[48;5;241m%} %{\e[48;5;242m%} %{\e[48;5;243m%} %{\e[48;5;244m%} %{\e[48;5;245m%} %{\e[48;5;246m%} %{\e[48;5;247m%} %{\e[48;5;248m%} %{\e[48;5;249m%} %{\e[48;5;250m%} %{\e[48;5;251m%} %{\e[48;5;252m%} %{\e[38;5;232m%}%D{%H:%M} %{\e[0m%}' ;; vt100|vt220) PS1="$host%{$fg_no_bold[$sep_color]%}:$cpath$end " ;; *) PS1="$date $host $cpath $end" ;; esac ## Or just choose one #PS1=$'%{\e[0;36m%}%n%{\e[0m%}:%{\e[0;31m%}%3~%{\e[0m%}%# ' ## user:~% #PS1=$'%{\e[0;36m%}%n%{\e[0m%}:%{\e[0;31m%}%3~%{\e[0m%}%B>%b ' ## user:~> #PS1='%n@%m:%4c%1v> ';RPS1=$'%{\e[0;36m%}%D{%A %T}%{\e[0m%}' ## user@host:~> ; Day time(hh:mm:ss) #PS1='%B[%b%n%B:%b%~%B]%b$ ' ## [user:~]$ #PS1=$'%{\e[0;36m%}%n%{\e[0m%}:%20<..<%~%B>%b ' ## user:..c/vim-common-6.0> #PS1=$'%{\e[0;36m%}%#%{\e[0m%} ';RPS1=$'%{\e[0;31m%}%~%{\e[0m%}' ## % ; ~ #PS1=$'%{\e[0;36m%}%n%{\e[0m%}%{\e[0;31m%}%#%{\e[0m%} ';RPS1=$'%{\e[0;31m%}%~%{\e[0m%}' ## user% ; ~ #PS1='%# ';RPS1='%B%~%b' ## % ; ~ : no colors #PS1='%n@%m:%B%~%b> ' ## user@host:~> : no colors ## or use neat prompt themes included with zsh #autoload -U promptinit #promptinit ## Currently available prompt themes: ## adam1 adam2 bart bigfade clint elite2 elite ## fade fire off oliver redhat suse walters zefram #prompt elite2 ############### # www.zshwiki.org # Prevent CVS files/directories from being completed zstyle ':completion:*:(all-|)files' ignored-patterns '(|*/)CVS' zstyle ':completion:*:cd:*' ignored-patterns '(*/)#CVS' # Add the hostnames from ~/.ssh/know_hosts to hosts (used by all commands that complete on hosts) if [[ -f $HOME/.ssh/known_hosts ]] ; then local _myhosts _myhosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[0-9]*}%%\ *}%%,*}) zstyle ':completion:*' hosts $_myhosts fi # Ignore completion functions for commands you don't have: zstyle ':completion:*:functions' ignored-patterns '_*' # With helper functions like: xdvi() { command xdvi ${*:-*.dvi(om[1])} } # you can avoid having to complete at all in many cases, but if you do, # you might want to fall into menu selection immediately and to have the # words sorted by time: zstyle ':completion:*:*:xdvi:*' menu yes select zstyle ':completion:*:*:xdvi:*' file-sort time # 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 # With commands like `rm' 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:*' ignore-line yes # when completing inside array or association subscripts, the array elements are # more useful than parameters so complete them first: zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters # in recent zsh 4.1.x only: complete the names of parameters we have special completions for in parameter assignments: #zstyle ':completion::*:(-command-|export):*' fake-parameters ${${${_comps[(I)-value-*]#*,}%%,*}:#-*-} # Here are functions to set the title and hardstatus of an XTerm or of # [GNU Screen] to 'zsh' and the current directory, respectively, when the prompt # is displayed, and to the command name and rest of the command line, # respectively, when a command is executed: function title { case $TERM in # *screen*) # # Use these two for GNU Screen: # print -nR $'\033k'$1$'\033'\\ # print -nR $'\033]0;'$2$'\a' #;; *xterm*|rxvt|(dt|k|E)term|*screen*) # Use this one instead for XTerms: print -nR $'\033]0;'$*$'\a'; ;; esac } function precmd { title "$HOST" "$PWD" } function preexec { emulate -L zsh local -a cmd; cmd=(${(z)1}) title $cmd[1]:t "$cmd[2,-1]" } #This line from my .screenrc lets me see this fancy hardstatus: # caption always "%3n %t%? (%u)%?%?: %h%?" # hgrep - highlight grep function hgrep() { if (( ! $# )); then echo "Usage: $0:t [-e pattern...] [file...]" >&2 return 1 fi local -a regex local htext=`echotc so` ntext=`echotc se` while [[ "$1" = -e ]]; do regex=( $regex "$2" ) shift 2 done if (( ! $#regex )); then regex=( "$1" ) shift fi regex=( "-e s/${^regex[@]}/$htext&$ntext/g" ) sed ${(Ff)regex[@]} "$@" } # QTDIR, si installé ! if [[ -d /usr/share/qt ]] ; then QTDIR=/usr/share/qt; export QTDIR; fi if [[ -e /usr/games/fortune ]] ; then printf "\n" /usr/games/fortune fi