X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/98cce464a451dba30327b140964b0eafbcb9b16a..35fab8a036e32f87e2ea96de0502b903a1c978e1:/cookbooks/accounts/files/default/tomh/.zshrc?ds=inline diff --git a/cookbooks/accounts/files/default/tomh/.zshrc b/cookbooks/accounts/files/default/tomh/.zshrc index 34122108b..1eae8a392 100644 --- a/cookbooks/accounts/files/default/tomh/.zshrc +++ b/cookbooks/accounts/files/default/tomh/.zshrc @@ -1,30 +1,3 @@ -# Set file creation mask -umask 002 - -# # No core dumps -limit coredumpsize 0 - -# Terminal initialization -stty -ixon -ttyctl -f - -# Make sure we know the username -if [[ -z "$USER" ]] -then - USER=`logname`; export USER -fi - -# Setup a default path -PATH=.:$HOME/bin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/X11R6/bin - -# Setup a pager -PAGER=less; export PAGER -LESS=aceiMs; export LESS - -# Use vi for editing -EDITOR=/usr/bin/vi; export EDITOR -VISUAL=/usr/bin/vi; export VISUAL - # Z-shell options setopt ALL_EXPORT setopt AUTO_CD @@ -33,86 +6,131 @@ setopt AUTO_MENU setopt CDABLE_VARS setopt CORRECT setopt CORRECT_ALL -setopt EXTENDED_GLOB +setopt HIST_EXPIRE_DUPS_FIRST setopt HIST_IGNORE_DUPS setopt HIST_NO_STORE +setopt HIST_REDUCE_BLANKS +setopt HIST_SAVE_NO_DUPS +setopt INC_APPEND_HISTORY setopt LIST_AMBIGUOUS setopt LIST_TYPES setopt LONG_LIST_JOBS setopt NO_BEEP setopt NO_NOMATCH setopt NOTIFY -setopt RC_EXPAND_PARAM +setopt PROMPT_SUBST +setopt PUSHD_SILENT setopt SH_WORD_SPLIT +# Disable bracketed paste mode +unset zle_bracketed_paste + # Keep tramp happy if [[ "$TERM" = "dumb" ]] then + unsetopt PROMPT_SP + unsetopt PROMPT_CR unsetopt ZLE fi +# Fallback to a more basic terminal type if necessary +if [[ -z "${terminfo[cols]}" ]] +then + case "$TERM" in + xterm*) TERM="xterm";; + esac +fi + +# Lock the terminal +ttyctl -f + +# Make sure we know the username +if [[ -z "$USER" ]] +then + USER="$(id -un)"; export USER +fi + +# Setup a default path +PATH=".:${HOME}/bin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin" + +# Setup a pager +PAGER="less"; export PAGER +LESS="aceiMRs"; export LESS + +# Use vi for editing +EDITOR=/usr/bin/vi; export EDITOR +VISUAL=/usr/bin/vi; export VISUAL + # History setup HISTFILE=$HOME/.zshhistory -SAVEHIST=200 -HISTSIZE=200 +SAVEHIST=1000 +HISTSIZE=1500 -# Files to ignore when completing +# Ignore certain files when doing expansion fignore=( \~ \# .o ) # Set the prompt -if [[ "$TERM" == "xterm" ]] -then - PROMPT="%{]2;%M%}%m [%~] %# " -else - PROMPT="%m [%~] %# " -fi +case "$TERM" in + xterm*) PROMPT="%{]0;\${ENVIRONMENT:+\${ENVIRONMENT} on} %M%}%m [%~] %# ";; + screen*) PROMPT="%{k\${ENVIRONMENT:+\${ENVIRONMENT} on} %M\%}%m [%~] %# ";; + *) PROMPT="%m [%~] %# ";; +esac -# Set aliases -alias ls="ls -CFh" +# Configure directory colours +eval "$(/usr/bin/dircolors --sh ${HOME}/.dir_colors)" + +# Setup aliases +alias ls="ls -CFhv --color=auto" alias df="df -h" alias du="du -h" +alias grep="grep --color=auto" +alias egrep="egrep --color=auto" +alias fgrep="fgrep --color=auto" +alias cd="nocorrect cd" # no spelling correction on cd alias mv="nocorrect mv" # no spelling correction on mv alias cp="nocorrect cp" # no spelling correction on cp alias mkdir="nocorrect mkdir" # no spelling correction on mkdir alias man="nocorrect man" # no spelling correction on man alias pg="less" -alias mailq="/usr/sbin/exim -bp" -alias runq="sudo /usr/sbin/exim -qq" -alias mailrm="sudo /usr/sbin/exim -Mrm" -alias mailedit="sudo /usr/sbin/exim -Meb" -alias mailfreeze="sudo /usr/sbin/exim -Mf" -alias mailthaw="sudo /usr/sbin/exim -Mt" - -# ish type history list (zsh: ctrl-v key, emacs ctrl-q key) -bindkey "\eOA" history-beginning-search-backward \ - "\e[A" history-beginning-search-backward \ - "\eOB" history-beginning-search-forward \ - "\e[B" history-beginning-search-forward \ - "\eOU" end-of-line \ - "\e[U" end-of-line \ - "^A" beginning-of-line \ - "^E" end-of-line \ - "\eOV" beginning-of-line \ - "\e[V" beginning-of-line \ - "\eOD" backward-char \ - "\e[D" backward-char \ - "\eOC" forward-char \ - "\e[C" forward-char \ - "^F" forward-word \ - "^B" backward-word \ - "\e[2~" overwrite-mode \ - "^P" push-line \ - "^K" kill-line \ - "\e[3~" delete-char - -# Completion options -. $HOME/.zcomp - -# Add the local functions to the function search path -fpath=($HOME/zshfuncs $fpath) - -# Autoload all functions on the function search path -foreach file in $HOME/zshfuncs/* -do - autoload `basename $file` -done + +# Select the emacs key map +bindkey -A emacs main + +# Bind various keys - hard code xterm bindings to match linux xterms +case "$TERM" in + dumb) + ;; + xterm*) + bindkey "^[OA" history-beginning-search-backward + bindkey "^[[A" history-beginning-search-backward + bindkey "^[OB" history-beginning-search-forward + bindkey "^[[B" history-beginning-search-forward + bindkey "^[OH" beginning-of-line + bindkey "^[OF" end-of-line + bindkey "^[[2~" overwrite-mode + bindkey "^[[3~" delete-char;; + *) + bindkey "${terminfo[kcuu1]}" history-beginning-search-backward + bindkey "^[[A" history-beginning-search-backward + bindkey "${terminfo[kcud1]}" history-beginning-search-forward + bindkey "^[[B" history-beginning-search-forward + bindkey "${terminfo[khome]}" beginning-of-line + bindkey "${terminfo[kend]}" end-of-line + bindkey "${terminfo[kich1]}" overwrite-mode + bindkey "${terminfo[kdch1]}" delete-char;; +esac + +# Configure completion +zstyle ":completion:*" completer _complete _approximate +zstyle ":completion:*" format "Completing %d" +zstyle ":completion:*" group-name "" +zstyle ":completion:*" menu select=long +zstyle ":completion:*" rehash true +zstyle ":completion:*" select-prompt "%SScrolling active: current selection at %p%s" + +# Enable completion +autoload -U compinit +compinit + +# Autoload all local functions +autoload ${HOME}/zshfuncs/*(:t)