# # $Id: dot-zshrc,v 1.1.1.1 2002/05/30 05:28:01 renaud Exp $ # # This is run after .zshenv, for interactive shells only. # ### terminal settings ################ # use the Meta key in emacs mode stty -parenb -istrip cs8 && bindkey -me # BackSpace key now works as expected stty erase '^H' # also fix Del, Home, End and Insert keys bindkey '^?' delete-char bindkey '^[[^@' beginning-of-line bindkey '^[[U' end-of-line # prompts PROMPT='%B%3. %#%b ' ; RPROMPT='%n@%m' # window title bar using_gui && echo "^[]0;$HOST^G" ### cd ############################### # go to directories without typing "cd" -- slow with CORRECT option setopt AUTO_CD # directories auto_cd applies to prepend_array cdpath . ~ # manage a directory stack setopt AUTO_PUSHD PUSHD_IGNORE_DUPS PUSHD_MINUS PUSHD_SILENT PUSHD_TO_HOME # size of directory stack DIRSTACKSIZE=16 ### completion ####################### # list matches with Tab, then cycle through the list setopt AUTO_LIST LIST_TYPES AUTO_MENU AUTO_PARAM_SLASH AUTO_REMOVE_SLASH # get hostnames from existing files ssh_hosts_file=~/.ssh/known_hosts [[ -f $ssh_hosts_file ]] && ssh_hosts=( `cut -d " " -f 1 $ssh_hosts_file` ) ftp_hosts_file=~/.netrc [[ -f $ftp_hosts_file ]] && ftp_hosts=( `grep "^mach" $ftp_hosts_file | cut -d " " -f 2` ) # fill in $hosts variable prepend_array hosts $ssh_hosts $ftp_hosts # these complete to $hosts compctl -k hosts telnet rlogin ftp ping traceroute # make the first argument complete to $hosts and treat the rest # as a command of its own compctl -k hosts -x 'p[2,-1]' -l '' -- rsh ssh # from the zsh FAQ compctl -u -k hosts -f -x 'n[1,:]' -f - 'n[1,@]' -k hosts -S ':' \ - 'p[1] W[2,*:*]' -f - 'p[1] W[2,*?*]' -u -k hosts -S ':' \ - 'p[2] W[1,*:*]' -f - 'p[2] W[1,*?*]' -u -k hosts -S ':' \ -- rcp scp ### aliases ########################## alias ls='ls -F' la='ls -FA' ll='ls -AlF' lo='ls -loAF' alias hi=history alias dh='dirs -v' alias j=jobs alias z=suspend alias md=mkdir rd=rmdir alias chx='chmod +x' alias tf='tail -f' alias su='su -m' alias m=more ; alias -g M='| more' alias g=egrep ; alias -g G='| egrep' alias h=head t=tail ; alias -g H='| head' T='| tail' alias s=sort ; alias -g S='| sort' ### options ########################### # allow comments in interactive shell setopt INTERACTIVE_COMMENTS # use ^, # and ~ globbing operators setopt EXTENDED_GLOB # long job listing setopt LONG_LIST_JOBS # "foo${xx}bar" with xx=(1 2 3) expands to "foo1bar foo2bar foo3bar" setopt RC_EXPAND_PARAM # '' inside single-quote strings is OK setopt RC_QUOTES # do not warn before executing "rm *" setopt RM_STAR_SILENT ### history ########################## # live history buffer HISTSIZE=128 # saved history file SAVEHIST=1024 HISTFILE=~/.zsh_history # history file configuration setopt APPEND_HISTORY EXTENDED_HISTORY HIST_IGNORE_DUPS [[ $ZSH_VERSION > 3.1 ]] && setopt HIST_NO_FUNCTIONS HIST_REDUCE_BLANKS ### misc ############################# # report login/logout activities watch=( all ) ; WATCHFMT='%n has %a from %M at %T.' # default editor export VISUAL=vi EDITOR=vi # check for new mail on every prompt # $MAIL is used for the mailbox file setopt MAIL_WARNING # du, df & co. report sizes in Mb export BLOCKSIZE=M ### local stuff ###################### # do local settings -- PUT YOUR LOCAL STUFF THERE local_zshrc=~/.zshrc-local [[ -f $local_zshrc ]] && source $local_zshrc