wok-6.x diff zsh/stuff/example.zshrc @ rev 22473
updated aespipe (2.4e -> 2.4f)
author | Hans-G?nter Theisgen |
---|---|
date | Fri Dec 27 17:45:00 2019 +0100 (2019-12-27) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/zsh/stuff/example.zshrc Fri Dec 27 17:45:00 2019 +0100 1.3 @@ -0,0 +1,113 @@ 1.4 +# history 1.5 +HISTFILE=~/.zsh_history 1.6 +HISTSIZE=5000 1.7 +SAVEHIST=1000 1.8 +setopt appendhistory autocd extendedglob 1.9 +setopt EXTENDED_HISTORY # puts timestamps in the history 1.10 + 1.11 +# default apps 1.12 + (( ${+BROWSER} )) || export BROWSER="w3m" 1.13 + (( ${+PAGER} )) || export PAGER="less" 1.14 + 1.15 +BLACK="%{"$'\033[01;30m'"%}" 1.16 +GREEN="%{"$'\033[01;32m'"%}" 1.17 +RED="%{"$'\033[01;31m'"%}" 1.18 +YELLOW="%{"$'\033[01;33m'"%}" 1.19 +BLUE="%{"$'\033[01;34m'"%}" 1.20 +BOLD="%{"$'\033[01;39m'"%}" 1.21 +NORM="%{"$'\033[00m'"%}" 1.22 + 1.23 + 1.24 +# prompt (if running screen, show window #) 1.25 +if [ x$WINDOW != x ]; then 1.26 + export PS1="$WINDOW:%~%# " 1.27 +else 1.28 + export PS1="[${RED}%n${YELLOW}@${BLUE}%U%m%u$:${GREEN}%2c${NORM}]%(!.#.$) " 1.29 + #right prompt - time/date stamp 1.30 + export RPS1="${GREEN}(%D{%m-%d %H:%M})${NORM}" 1.31 +fi 1.32 + 1.33 +# format titles for screen and rxvt 1.34 +function title() { 1.35 + # escape '%' chars in $1, make nonprintables visible 1.36 + a=${(V)1//\%/\%\%} 1.37 + 1.38 + # Truncate command, and join lines. 1.39 + a=$(print -Pn "%40>...>$a" | tr -d "\n") 1.40 + 1.41 + case $TERM in 1.42 + screen) 1.43 + print -Pn "\ek$a:$3\e\\" # screen title (in ^A") 1.44 + ;; 1.45 + xterm*|rxvt) 1.46 + print -Pn "\e]2;$2 | $a:$3\a" # plain xterm title 1.47 + ;; 1.48 + esac 1.49 +} 1.50 + 1.51 +# precmd is called just before the prompt is printed 1.52 +function precmd() { 1.53 + title "zsh" "$USER@%m" "%55<...<%~" 1.54 +} 1.55 + 1.56 +# preexec is called just before any command line is executed 1.57 +function preexec() { 1.58 + title "$1" "$USER@%m" "%35<...<%~" 1.59 +} 1.60 + 1.61 +# vi editing 1.62 +bindkey -v 1.63 + 1.64 +# colorful listings 1.65 +zmodload -i zsh/complist 1.66 +zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} 1.67 + 1.68 +autoload -U compinit 1.69 +compinit 1.70 + 1.71 +# aliases 1.72 +alias mv='nocorrect mv' # no spelling correction on mv 1.73 +alias cp='nocorrect cp' 1.74 +alias mkdir='nocorrect mkdir' 1.75 +alias j=jobs 1.76 +if ls -F --color=auto >&/dev/null; then 1.77 + alias ls="ls --color=auto -F" 1.78 +else 1.79 + alias ls="ls -F" 1.80 +fi 1.81 +alias ll="ls -l" 1.82 +alias ..='cd ..' 1.83 +alias .='pwd' 1.84 + 1.85 +# functions 1.86 +setenv() { export $1=$2 } # csh compatibility 1.87 + 1.88 +#bash style ctrl-a (beginning of line) and ctrl-e (end of line) 1.89 +bindkey '^a' beginning-of-line 1.90 +bindkey '^e' end-of-line 1.91 + 1.92 +# Emulate tcsh's backward-delete-word 1.93 +tcsh-backward-delete-word () { 1.94 + #local WORDCHARS="${WORDCHARS:s#/#}" 1.95 + local WORDCHARS='*?_[]~\!#$%^<>|`@#$%^*()+?' 1.96 + zle backward-delete-word 1.97 +} 1.98 + 1.99 +zle -N tcsh-backward-delete-word 1.100 + 1.101 +bindkey '\e^H' tcsh-backward-delete-word 1.102 + 1.103 +#if this is uncommented, it will ignore the stop-at-special-chars 1.104 +#bindkey '\e^H' backward-delete-word 1.105 + 1.106 +#uncomment this to have a nice update script that will cause ur zshrc to update from a central location 1.107 + 1.108 +#selfupdate(){ 1.109 +# URL="http://stuff.mit.edu/~jdong/misc/zshrc" 1.110 +# echo "Updating zshrc from $URL..." 1.111 +# echo "Press Ctrl+C within 5 seconds to abort..." 1.112 +# sleep 5 1.113 +# cp ~/.zshrc ~/.zshrc.old 1.114 +# wget $URL -O ~/.zshrc 1.115 +# echo "Done; existing .zshrc saved as .zshrc.old" 1.116 +#}