Created
May 26, 2013 19:18
-
-
Save raphaelm/5653738 to your computer and use it in GitHub Desktop.
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
# History | |
HISTFILE=~/.histfile | |
HISTSIZE=1000 | |
SAVEHIST=1000 | |
zstyle :compinstall filename '/home/raphael/.zshrc' | |
# Load colors | |
autoload -U colors && colors | |
# Predefine some colors | |
fg_white=$'%{\e[0;37m%}' | |
fg_dark_blue=$'%{\e[0;36m%}' | |
fg_no_colour=$'%{\e[0m%}' | |
# Colors for ls | |
zmodload zsh/complist | |
export LS_COLORS='di=01;34:ln=01;36:pi=33:so=01;35:bd=01;33:cd=01;33:ex=01;32:do=01;35:su=37;41:sg=30;43:st=37;44:ow=34;42:tw=30;42:ca=30;41' | |
autoload -Uz compinit && compinit | |
# Offers menu when > selected elements appear | |
zstyle ':completion:*' menu select=2 | |
# Load colors | |
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} | |
zstyle ':completion:*:processes' command 'ps -ax' | |
zstyle ':completion:*:processes-names' command 'ps -aeo comm=' | |
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31' menu yes select | |
zstyle ':completion:*:*:killall:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31' menu yes select | |
# SSH host completion | |
zstyle -e ':completion::*:*:*:hosts' hosts 'reply=(${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) /dev/null)"}%%[# ]*}//,/ })' | |
# Separate matches into groups and highlight them | |
zstyle ':completion:*:matches' group 'yes' | |
zstyle ':completion:*' group-name '' | |
zstyle ':completion:*:descriptions' format $'%{\e[0;31m%}%B%d%b%{\e[0m%}' | |
# Use emacs style for input keys by default | |
bindkey -e | |
bindkey '\e[A' up-line-or-search # cursor up | |
bindkey '\e[B' down-line-or-search # cursor down | |
bindkey '\e[7~' beginning-of-line # home | |
bindkey '\e[8~' end-of-line # end | |
bindkey '\e5c' forward-word # ctrl cursor right | |
bindkey '\e5d' backward-word # ctrl cursor left | |
export WORDCHARS='.,*?_-[]~=&;!#$%^(){}<>' | |
# Case-insensitive,partial-word and then substring completion | |
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' | |
# Support colors in less | |
export LESS_TERMCAP_mb=$'\E[01;31m' | |
export LESS_TERMCAP_md=$'\E[01;31m' | |
export LESS_TERMCAP_me=$'\E[0m' | |
export LESS_TERMCAP_se=$'\E[0m' | |
export LESS_TERMCAP_so=$'\E[01;44;33m' | |
export LESS_TERMCAP_ue=$'\E[0m' | |
export LESS_TERMCAP_us=$'\E[01;32m' | |
autoload -Uz vcs_info | |
autoload -Uz compinit | |
compinit | |
# End of lines added by compinstall | |
### Options | |
setopt correct | |
setopt autocd | |
setopt share_history | |
setopt auto_pushd | |
fg_dark_blue=$'%{\e[0;36m%}' | |
fg_no_colour=$'%{\e[0m%}' | |
### Aliases | |
alias ls='ls --color=auto' | |
alias ll='ls -lisah' | |
alias ag='sudo apt-get' | |
alias agi='sudo apt-get install' | |
alias agr='sudo apt-get remove' | |
alias agu='sudo sh -c "apt-get update && apt-get dist-upgrade && apt-get autoremove && apt-get autoclean"' | |
alias ags='apt-cache search' | |
alias hig='history | grep' | |
alias psg='ps aux | grep' | |
alias svim='sudo vim' | |
alias g='git' | |
alias gst='g status' | |
alias glog="g log --graph --pretty=format:'%C(yellow)%h%Creset -%Cred%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --date=relative" | |
alias ga='g add' | |
alias gap='g add -p' | |
alias gd='g diff' | |
alias gc='g commit' | |
alias gb='g branch' | |
alias gpom='g push origin master' | |
alias grep='grep --color=auto --initial-tab' | |
alias ack='ack-grep' | |
### Scripts | |
rationalise-dot() { | |
if [[ $LBUFFER = *.. ]]; then | |
LBUFFER+=/.. | |
else | |
LBUFFER+=. | |
fi | |
} | |
zle -N rationalise-dot | |
bindkey . rationalise-dot | |
# GIT prompt | |
setopt prompt_subst | |
zstyle ':vcs_info:*' enable git | |
zstyle ':vcs_info:*' formats "${fg_dark_blue}%b${fg_no_colour} " | |
precmd (){ | |
vcs_info | |
} | |
setup_prompt() { | |
if [ ! -z "$SSH_CONNECTION" ]; then | |
_user_="%n@%m" | |
else | |
_user_="%n" | |
fi | |
PROMPT="$_user_ %~ \${vcs_info_msg_0_}$ " | |
} | |
setup_prompt | |
[email protected] | |
DEBFULLNAME="Raphael Michel" | |
export DEBEMAIL DEBFULLNAME | |
if [ -f ~/src/arcanist/resources/shell/bash-completion ] | |
then | |
source ~/src/arcanist/resources/shell/bash-completion | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment