Created
October 25, 2011 12:08
-
-
Save nikopol/1312500 to your computer and use it in GitHub Desktop.
niko's zshrc
This file contains hidden or 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
# niko's zsh conf | |
### VARIABLES | |
HISTFILE=~/.histfile | |
HISTSIZE=1000 | |
SAVEHIST=1000 | |
export EDITOR="vim" | |
export PAGER="vimpager" | |
export PATH="${PATH}:${HOME}/bin" | |
export LS_COLORS='di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:tw=31;33;01:ow=31;31;01:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:'; | |
### KEYBINDINGS | |
bindkey -v | |
typeset -g -A key | |
#bindkey '\e[3~' delete-char | |
bindkey '\e[1~' beginning-of-line | |
bindkey '\e[4~' end-of-line | |
#bindkey '\e[2~' overwrite-mode | |
bindkey '^?' backward-delete-char | |
bindkey '^[[1~' beginning-of-line | |
bindkey '^[[5~' up-line-or-history | |
bindkey '^[[3~' delete-char | |
bindkey '^[[4~' end-of-line | |
bindkey '^[[6~' down-line-or-history | |
bindkey '^[[A' up-line-or-search | |
bindkey '^[[D' backward-char | |
bindkey '^[[B' down-line-or-search | |
bindkey '^[[C' forward-char | |
# for rxvt | |
bindkey "\e[8~" end-of-line | |
bindkey "\e[7~" beginning-of-line | |
# for gnome-terminal | |
bindkey "\eOH" beginning-of-line | |
bindkey "\eOF" end-of-line | |
### ALIAS | |
alias ls="ls --color" | |
alias l="ls -lh" | |
alias ll="ls -lah" | |
alias spm="sudo pacman" | |
alias spmc="sudo pacman-color" | |
### COMPLETION | |
zmodload zsh/complist | |
autoload -Uz compinit | |
compinit | |
zstyle :compinstall filename '${HOME}/.zshrc' | |
#- buggy | |
zstyle ':completion:*:descriptions' format '%U%B%d%b%u' | |
zstyle ':completion:*:warnings' format '%BSorry, no matches for: %d%b' | |
#-/buggy | |
zstyle ':completion:*:pacman:*' force-list always | |
zstyle ':completion:*:*:pacman:*' menu yes select | |
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} | |
zstyle ':completion:*:*:kill:*' menu yes select | |
zstyle ':completion:*:kill:*' force-list always | |
zstyle ':completion:*:*:killall:*' menu yes select | |
zstyle ':completion:*:killall:*' force-list always | |
### EVENTS | |
case $TERM in | |
*xterm*|rxvt*|(dt|k|E)term) | |
precmd () { | |
print -Pn "\e]0;%n@%M:%~\a" | |
EPOCH="`date +%s`" | |
if [[ -n $PR_LASTCMDSTART ]]; then | |
EPOCH="`date +%s`" | |
EXECTIME=$(( $EPOCH - $PR_LASTCMDSTART )) | |
if [[ $EXECTIME -lt 120 ]]; then export PR_LASTCMDTIME="${EXECTIME}s"; | |
elif [[ $EXECTIME -lt 3600 ]]; then export PR_LASTCMDTIME="$((EXECTIME/60))m$((EXECTIME%60))s"; | |
else export PR_LASTCMDTIME="`printf '%d:%02d:%02d' EXECTIME/3600 EXECTIME%3600/60 EXECTIME%60`"; | |
fi | |
unset PR_LASTCMDSTART | |
else | |
export PR_LASTCMDTIME="" | |
fi | |
_GB=$(git_branch) | |
if [[ -z "$_GB" ]]; then | |
eval PR_GIT='' | |
else | |
eval PR_GIT='${PR_RED}[${_GB}]' | |
fi | |
export PR_GIT | |
} | |
preexec () { | |
print -Pn "\e]0;%n@%M:%~ ($1)\a" | |
export PR_LASTCMDSTART="`date +%s`" | |
} | |
;; | |
screen) | |
precmd () { | |
print -Pn "\e]83;title \"$1\"\a" | |
print -Pn "\e]0;$TERM - (%L) %n@%M %~\a" | |
} | |
preexec () { | |
print -Pn "\e]83;title \"$1\"\a" | |
print -Pn "\e]0;$TERM - (%L) %n@%M %~ ($1)\a" | |
} | |
;; | |
esac | |
### PROMPT | |
function git_branch() { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || return | |
echo ${ref#refs/heads/} | |
} | |
# load some modules | |
autoload -U colors zsh/terminfo # Used in the colour alias below | |
colors | |
setopt prompt_subst | |
# make some aliases for the colours: (coud use normal escap.seq's too) | |
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE GREY; do | |
eval PR_$color='%{$fg[${(L)color}]%}' | |
done | |
PR_NO_COLOR="%{$terminfo[sgr0]%}" | |
if [[ $UID -ge 1000 ]]; then #user | |
eval PR_USER='${PR_GREEN}%n' | |
elif [[ $UID -eq 0 ]]; then #root | |
eval PR_USER='${PR_RED}%n' | |
fi | |
if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then | |
eval PR_HOST='${PR_MAGENTA}%M' #ssh | |
else | |
eval PR_HOST='${PR_YELLOW}%M' #local | |
fi | |
_GB=$(git_branch) | |
if [[ -z "$_GB" ]]; then | |
eval PR_GIT='' | |
else | |
eval PR_GIT='${PR_RED}[${_GB}]' | |
fi | |
# set the prompt | |
PS1=$'%B${PR_USER}${PR_BLUE}@${PR_HOST}${PR_BLUE}:${PR_WHITE}%~%b${PR_GIT}${PR_BLUE}#${PR_NO_COLOR} ' | |
PS2=$'%_>' | |
RPROMPT='${PR_BLUE}${PR_LASTCMDTIME} %? %D{%H:%M}${PR_NO_COLOR}' | |
export PERL_LOCAL_LIB_ROOT="/home/niko/perl5"; | |
export PERL_MB_OPT="--install_base /home/niko/perl5"; | |
export PERL_MM_OPT="INSTALL_BASE=/home/niko/perl5"; | |
export PERL5LIB="/home/niko/perl5/lib/perl5/x86_64-linux-thread-multi:/home/niko/perl5/lib/perl5"; | |
export PATH="/home/niko/perl5/bin:$PATH"; | |
source ~/bin/perl5lib >/dev/null | |
~/bin/hi -s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment