Created
April 12, 2011 02:48
-
-
Save kcbanner/914831 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# kcbanner's zshrc file v0.1, based on: | |
# jdong's zshrc file v0.2.1 and | |
# mako's zshrc file, v0.1 | |
setopt ALL_EXPORT | |
# Set/unset shell options | |
setopt notify globdots correct pushdtohome cdablevars autolist | |
setopt correctall autocd recexact longlistjobs nohup incappendhistory sharehistory extendedhistory | |
setopt autoresume histignoredups pushdsilent menucomplete | |
setopt autopushd pushdminus extendedglob rcquotes mailwarning | |
unsetopt bgnice autoparamslash | |
# Autoload zsh modules when they are referenced | |
zmodload -a zsh/stat stat | |
zmodload -a zsh/zpty zpty | |
zmodload -a zsh/zprof zprof | |
zmodload -a zsh/mapfile mapfile | |
PATH="/usr/local/bin:/usr/local/sbin/:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/cross/bin:$PATH" | |
PATH=$HOME/local/node/bin:$PATH | |
TZ="America/Toronto" | |
HISTFILE=$HOME/.zhistory | |
HISTSIZE=1000 | |
SAVEHIST=1000 | |
HOSTNAME="`hostname`" | |
PAGER='less' | |
TERM='xterm-color' | |
EDITOR='emacs' | |
autoload colors zsh/terminfo | |
if [[ "$terminfo[colors]" -ge 8 ]]; then | |
colors | |
fi | |
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do | |
eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}' | |
eval PR_LIGHT_$color='%{$fg[${(L)color}]%}' | |
(( count = $count + 1 )) | |
done | |
PR_NO_COLOR="%{$terminfo[sgr0]%}" | |
PS1="[$PR_BLUE%n$PR_WHITE@$PR_GREEN%U%m%u$PR_NO_COLOR:$PR_RED%2c$PR_NO_COLOR]%(!.#.$) " | |
RPS1="$PR_LIGHT_YELLOW(%D{%m-%d %H:%M})$PR_NO_COLOR" | |
LC_ALL='en_US.UTF-8' | |
LANG='en_US.UTF-8' | |
LC_CTYPE=C | |
unsetopt ALL_EXPORT | |
alias yaourt="color='' yaourt" | |
alias man='LC_ALL=C LANG=C man' | |
alias ls='ls --color=auto ' | |
alias =clear | |
autoload -U compinit | |
compinit | |
bindkey "^r" history-incremental-search-backward | |
bindkey '^I' complete-word # complete on tab, leave expansion to _expand | |
zstyle ':completion::complete:*' use-cache on | |
zstyle ':completion::complete:*' cache-path ~/.zsh/cache/$HOST | |
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} | |
zstyle ':completion:*' list-prompt '%SAt %p: Hit TAB for more, or the character to insert%s' | |
zstyle ':completion:*' menu select=1 _complete _ignored _approximate | |
zstyle -e ':completion:*:approximate:*' max-errors \ | |
'reply=( $(( ($#PREFIX+$#SUFFIX)/2 )) numeric )' | |
zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s' | |
# Completion Styles | |
# list of completers to use | |
zstyle ':completion:*::::' completer _expand _complete _ignored _approximate | |
# allow one error for every three characters typed in approximate completer | |
zstyle -e ':completion:*:approximate:*' max-errors \ | |
'reply=( $(( ($#PREFIX+$#SUFFIX)/2 )) numeric )' | |
# insert all expansions for expand completer | |
zstyle ':completion:*:expand:*' tag-order all-expansions | |
# formatting and messages | |
zstyle ':completion:*' verbose yes | |
zstyle ':completion:*:descriptions' format '%B%d%b' | |
zstyle ':completion:*:messages' format '%d' | |
zstyle ':completion:*:warnings' format 'No matches for: %d' | |
zstyle ':completion:*:corrections' format '%B%d (errors: %e)%b' | |
zstyle ':completion:*' group-name '' | |
# match uppercase from lowercase | |
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' | |
# offer indexes before parameters in subscripts | |
zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters | |
## add colors to processes for kill completion | |
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31' | |
zstyle ':completion:*:*:kill:*:processes' command 'ps --forest -A -o pid,user,cmd' | |
zstyle ':completion:*:processes-names' command 'ps axho command' | |
# New completion: | |
# 1. All /etc/hosts hostnames are in autocomplete | |
# 2. If you have a comment in /etc/hosts like #%foobar.domain, | |
# then foobar.domain will show up in autocomplete! | |
zstyle ':completion:*' hosts $(awk '/^[^#]/ {print $2 $3" "$4" "$5}' /etc/hosts | grep -v ip6- && grep "^#%" /etc/hosts | awk -F% '{print $2}') | |
# http://www.sourceguru.net/ssh-host-completion-zsh-stylee/ | |
zstyle -e ':completion::*:*:*:hosts' hosts 'reply=(${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) /dev/null)"}%%[# ]*}//,/ })' | |
# ignore completion functions (until the _ignored completer) | |
zstyle ':completion:*:functions' ignored-patterns '_*' | |
zstyle ':completion:*:*:*:users' ignored-patterns \ | |
adm apache bin daemon games gdm halt ident junkbust lp mail mailnull \ | |
named news nfsnobody nobody nscd ntp operator pcap postgres radvd \ | |
rpc rpcuser rpm shutdown squid sshd sync uucp vcsa xfs avahi-autoipd\ | |
avahi backup messagebus beagleindex debian-tor dhcp dnsmasq fetchmail\ | |
firebird gnats haldaemon hplip irc klog list man cupsys postfix\ | |
proxy syslog www-data mldonkey sys snort | |
# SSH Completion | |
zstyle ':completion:*:scp:*' tag-order files users 'hosts:-host hosts:-domain:domain hosts:-ipaddr"IP\ Address *' | |
zstyle ':completion:*:scp:*' group-order files all-files users hosts-domain hosts-host hosts-ipaddr | |
zstyle ':completion:*:ssh:*' tag-order users 'hosts:-host hosts:-domain:domain hosts:-ipaddr"IP\ Address *' | |
zstyle ':completion:*:ssh:*' group-order hosts-domain hosts-host users hosts-ipaddr | |
zstyle '*' single-ignored show |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sweet! Thanks for this.