if [[ -r ~/.zsh-local ]] then . ~/.zsh-local fi export XAPPLRESDIR=~/xsteve-config/app-defaults/ export EDITOR=emacsclient # nice zsh functions autoload -U is-at-least #not needed here #eval `dircolors -b` LS_OPTIONS="--color=auto" # aliases alias ls='ls $LS_OPTIONS' alias dir='ls -l' alias ll='ls -l' alias la='ls -la' alias l='ls -alF' alias d='ls -l -L' alias rm='rm -i' alias cp='nocorrect cp' alias mv='nocorrect mv' alias mkdir='nocorrect mkdir' alias xxpdf='xpdf -remote xxpdf -z page' # Global aliases alias -g L='|less' alias -g G='|grep' alias -g E='|emacs-pipe' # Register specific applications for some file endings alias -s dvi=xdvi alias -s pdf=xpdf # use the zsh completion system autoload -U compinit compinit bindkey -s '\e.' ' cd ..\n' # M-. bindkey -s '\e[17~' 'scons -u -j2\n' # F6 # new style is flexibler: #do-scons() { # LBUFFER="scons -u -j2" # can use also $LBUFFER and other environment variables here... # zle accept-line #} #zle -N do-scons #bindkey '\e[17~' do-scons do-cd-emacs() { LBUFFER="cd $(cat ~/.emacs.d/current-directory)" zle accept-line } zle -N do-cd-emacs bindkey '\e[21~' do-cd-emacs #F10 setopt all_export setopt menu_complete setopt auto_cd setopt auto_list setopt cdablevars setopt correct_all setopt no_beep setopt list_packed setopt numericglobsort setopt noflowcontrol setopt extendedglob setopt ignore_eof setopt no_clobber setopt magicequalsubst setopt complete_in_word # history specific options setopt hist_allow_clobber setopt hist_ignore_dups setopt hist_ignore_space setopt hist_no_store setopt hist_expire_dups_first setopt hist_find_no_dups setopt extended_history setopt inc_append_history # read the history file from another shell via: fc -RI # Command history environment variables HISTFILE="$HOME/.zsh_history" HISTSIZE=50000 SAVEHIST=50000 # use programs in /opt only on i686 (redhat) platforms if [[ $(uname -m) == "i686" ]] then PATH=/opt/bin:$PATH MANPATH=/opt/man:$MANPATH LD_LIBRARY_PATH=/opt/lib:$LD_LIBRARY_PATH fi # Better run-help (on ESC-h) # The unalias is unnecessary for modern zsh versions (>=4.3) unalias -m run-help autoload -U run-help # automagic url quoter autoload -U url-quote-magic zle -N self-insert url-quote-magic # Common terminal keybindings bindkey '\e[1~' beginning-of-line bindkey '\e[4~' end-of-line bindkey '\e[3~' delete-char-or-list # Some emacs bindings bindkey "^hw" where-is bindkey "^hc" describe-key-briefly function precmd { # Display the directory in the xterm header line print -Pn "\e]2;%n@%m:%~\a" #find a better test then an existing acpi for the battery state display #if [[ -x /usr/bin/acpi ]] then # bat=" [${${${=$(acpi)}[4]}%,}%]%" #else # bat="" #fi bat="" #PROMPT=$(echo "$bat%(?..%{\e[41;38m%}%B-%?-%b%{\e[0m%} )%(1j.%{\e[01;32m%}[%j]%{\e[0m%} .)%n@%m:%~%# ") RPROMPT=$(echo "%T$bat") } #%(?..%{\e[41;38m%}%B-%?-%b%{\e[0m%} ) show the exit status of the last cmd if it was not zero. #%(1j.%{\e[01;32m%}[%j]%{\e[0m%} .) show the number of child jobs in green #%n username #%m hostname up to the first . #%~ pwd declare PROMPT=$'%(?..%{\e[41;38m%}%B-%?-%b%{\e[0m%} )%(1j.%{\e[01;32m%}[%j]%{\e[0m%} .)%n@%m:%3~%3# ' #declare RPROMPT=$'%T %{\e[01;31m%}[%!]%{\e[0m%}' # history # on right # this one is very nice: # cursor up/down look for a command that started like the one starting on the command line function history-search-end { integer ocursor=$CURSOR if [[ $LASTWIDGET = history-beginning-search-*-end ]]; then # Last widget called set $hbs_pos. CURSOR=$hbs_pos else hbs_pos=$CURSOR fi if zle .${WIDGET%-end}; then # success, go to end of line zle .end-of-line else # failure, restore position CURSOR=$ocursor return 1 fi } zle -N history-beginning-search-backward-end history-search-end zle -N history-beginning-search-forward-end history-search-end # some keys #bindkey "\e[A" history-beginning-search-backward #cursor up #bindkey "\e[B" history-beginning-search-forward #cursor down bindkey "\e[A" history-beginning-search-backward-end #cursor up bindkey "\e[B" history-beginning-search-forward-end #cursor down ## dabbrev for zsh!! zstyle ':completion:history-words:*:history-words' stop yes zstyle ':completion:history-words:*:history-words' list no zstyle ':completion:history-words:*' remove-all-dups yes zstyle ':completion:history-words:*' menu yes bindkey '\e[15~' _history-complete-older #F5 bindkey '\e[28~' _history-complete-newer #Shift-F5 # show the path on the title line # that is now done in precmd #chpwd() { # [[ -t 1 ]] || return # case $TERM in # sun-cmd) print -Pn "\e]l%~\e\\" # ;; # *xterm*|rxvt|(dt|k|E)term) print -Pn "\e]2;%n@%m:%~\a" # ;; # esac #} # cache the completions (default: in ~/.zcompcache/) zstyle ':completion::complete:*' use-cache on # zstyle ':completion::complete:*' cache-path ~/.zsh/cache/$HOST ## add colors to processes for kill completion zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31' # use menu completion #zstyle ':completion:*' menu select=1 _complete _ignored _approximate # use menu completion for the kill command zstyle ':completion:*:*:kill:*' menu select=1 _complete _ignored _approximate # specify the sort order zstyle ':completion:*' file-sort name zstyle ':completion:*:*:(xpdf|xdvi):*' file-sort time # for cp, mv, rm: Add each argument only once zstyle ':completion:*:(cp|mv|rm):*' ignore-line yes # todo: find out the default for the tag-order below # this one allows only to cd to a local-directory zstyle ':completion:*:*:cd:*' tag-order local-directories # e.g. ecwhence hac-util function ecwhence {emacsclient --no-wait "${~$(whence $1)}"} compdef _command_names ecwhence function ec { emacsclient --no-wait "$PWD/$1" } function ecw { emacsclient "$PWD/$1" } function create-tgz { local archive_name archive_name="$1.tar.gz" archive_name=${archive_name/\//} tar cvfz "$archive_name" "$1" echo "Created archive $archive_name" } # Use only directories for create-tgz completion: compdef _directories create-tgz # grep the history function greph () { history 0 | grep $1 } # list the 10 newest files # *(om[1,10]) ... the 30 last modified files # -t ... sort by date # -r ... sort in reverse # ls -tr -dl $1(om[1,30]) function lsnew () { if [[ $1 = "" ]]; then lsnew_glob="*" else lsnew_glob=$1 fi ls -tr -dl $~lsnew_glob(om[1,30]) } alias lsnew='noglob lsnew' # use the built in directory navigation via the directory stack # depth of the directory history DIRSTACKSIZE=30 # automatic pushd setopt AUTO_PUSHD # exchange meaning of + and - setopt PUSHD_MINUS # don't tell me about automatic pushd setopt PUSHD_SILENT # use $HOME when no arguments specified setopt PUSHD_TO_HOME # ignore duplicates setopt PUSHD_IGNOREDUPS # keep a persistent dirstack in ~/.zdirs, from Francisco Borges, on zsh.devel if (is-at-least 4.1) then # needs at least zsh 4.1 for dirs -p if [[ -f ~/.zdirs ]] && [[ ${#dirstack[*]} -eq 0 ]]; then dirstack=( ${(uf)"$(< ~/.zdirs)"} ) #echo "Loaded the dirstack from disk" fi chpwd() { dirs -pl >! ~/.zdirs } fi # load in company specific settings if available if [[ -r ~/.zsh-ger ]] then . ~/.zsh-ger fi # if [[ -r ~/.zsh-local-post ]] then . ~/.zsh-local-post fi # arch-tag: c39da264-3375-4e1f-93a5-9591888d5b64