Created
June 27, 2012 14:27
-
-
Save petrhosek/3004398 to your computer and use it in GitHub Desktop.
Z Shell
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
if [ -f ~/.zshrc ]; then | |
source ~/.zshrc | |
fi | |
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" | |
export NODE_PATH=/usr/local/lib/node_modules | |
export PATH=$PATH:$HOME/.local/bin |
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
# ~/.zshrc: executed by zsh(1) for non-login shells. | |
autoload -U compinit promptinit | |
compinit | |
promptinit | |
setopt completealiases | |
# save history into file | |
export HISTFILE=~/.zsh_history | |
# for setting history length see HISTSIZE and SAVEHIST in zsh(1) | |
export HISTSIZE=1000 | |
export SAVEHIST=2000 | |
# don't put duplicate lines in the history | |
setopt HIST_REDUCE_BLANKS | |
setopt HIST_IGNORE_SPACE | |
setopt autopushd pushdminus pushdsilent pushdtohome | |
setopt autocd | |
setopt cdablevars | |
setopt ignoreeof | |
setopt interactivecomments | |
setopt nobanghist | |
setopt noclobber | |
setopt SH_WORD_SPLIT | |
setopt nohup | |
# PS1 and PS2 | |
export PS1="$(print '%{\e[1;34m%}%m%{\e[0m%}'):$(print '%{\e[0;34m%}%c%{\e[0m%}') %n% $ " | |
export PS2="$(print '%{\e[0;34m%}>%{\e[0m%}')" | |
# Vars used later on by Zsh | |
export EDITOR="nano" | |
export BROWSER=links | |
export XTERM="aterm +sb -geometry 80x29 -fg black -bg lightgoldenrodyellow -fn -xos4-terminus-medium-*-normal-*-14-*-*-*-*-*-iso8859-15" | |
################################################################## | |
# Stuff to make my life easier | |
# allow approximate | |
zstyle ':completion:*' completer _complete _match _approximate | |
zstyle ':completion:*:match:*' original only | |
zstyle ':completion:*:approximate:*' max-errors 1 numeric | |
# tab completion for process identifiers | |
zstyle ':completion:*:*:kill:*' menu yes select | |
zstyle ':completion:*:kill:*' force-list always | |
# change dir not select parent dir | |
zstyle ':completion:*:cd:*' ignore-parents parent pwd | |
# add remote hostnames | |
zstyle ':completion::*:hosts' hosts 'reply=($(sed -e "/^#/d" -e "s/ .*\$//" -e "s/,/ /g" /etc/ssh_known_hosts(N) ~/.ssh/known_hosts(N) 2>/dev/null | xargs) $(grep \^Host ~/.ssh/config(N) | cut -f2 -d\ 2>/dev/null | xargs))' | |
# useful for path editing — backward-delete-word, but with / as additional delimiter | |
backward-delete-to-slash () { | |
local WORDCHARS=${WORDCHARS//\//} | |
zle .backward-delete-word | |
} | |
zle -N backward-delete-to-slash | |
################################################################## | |
# Key bindings | |
# http://mundy.yazzy.org/unix/zsh.php | |
# http://www.zsh.org/mla/users/2000/msg00727.html | |
typeset -g -A key | |
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 | |
bindkey '^[w' backward-delete-to-slash | |
# completion in the middle of a line | |
bindkey '^i' expand-or-complete-prefix | |
################################################################## | |
# My aliases | |
# auto extension stuff | |
alias -s html=$BROWSER | |
alias -s org=$BROWSER | |
alias -s php=$BROWSER | |
alias -s com=$BROWSER | |
alias -s net=$BROWSER | |
alias -s png=feh | |
alias -s jpg=feh | |
alias -s gif=feg | |
alias -s sxw=soffice | |
alias -s doc=soffice | |
alias -s gz='tar -xzvf' | |
alias -s bz2='tar -xjvf' | |
alias -s xz='tar -xJvf' | |
alias -s java=$EDITOR | |
alias -s txt=$EDITOR | |
alias -s PKGBUILD=$EDITOR | |
# normal aliases | |
alias ls='ls -G' | |
#alias dir='dir --color=auto' | |
#alias vdir='vdir --color=auto' | |
alias grep='grep --color=auto' | |
alias fgrep='fgrep --color=auto' | |
alias egrep='egrep --color=auto' | |
# some more ls aliases | |
alias ll='ls -alF' | |
alias la='ls -A' | |
alias l='ls -CF' | |
# Alias definitions | |
# You may want to put all your additions into a separate file like | |
# ~/.zsh_aliases, instead of adding them here directly. | |
if [ -f ~/.zsh_aliases ]; then | |
. ~/.zsh_aliases | |
fi | |
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment