Skip to content

Instantly share code, notes, and snippets.

@NTICompass
Last active August 29, 2015 14:19
Show Gist options
  • Save NTICompass/c6657a1a2485eb17e39f to your computer and use it in GitHub Desktop.
Save NTICompass/c6657a1a2485eb17e39f to your computer and use it in GitHub Desktop.
So I can easily get my zsh config file on new machines
# Initialize Autocompletion and Autocorrection
autoload -U compinit promptinit
compinit
promptinit
#prompt redhat
zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
zstyle ':completion:*:warnings' format '%BSorry, no matches for: %d%b'
zstyle ':completion::complete:*' use-cache 1
setopt correctall
# Custom PS1
autoload -U colors && colors
#PS1="%n@%m %c %% "
PS1="%{$fg[blue]%}%n@%m %{$fg[yellow]%}%c %% %{$reset_color%}"
# cd is automagically added
setopt autocd
# Save History
HISTSIZE=1000
SAVEHIST=1000
HISTFILE=~/.bash_history
setopt hist_ignore_all_dups
# Keybindings
# https://wiki.archlinux.org/index.php/Zsh#Key_bindings
autoload zkbd
if [ -f ~/.zkbd/$TERM-$DISPLAY ]
then
source ~/.zkbd/$TERM-$DISPLAY
else
source ~/.zkbd/$TERM-$VENDOR-$OSTYPE
fi
[[ -n ${key[Backspace]} ]] && bindkey "${key[Backspace]}" backward-delete-char
[[ -n ${key[Insert]} ]] && bindkey "${key[Insert]}" overwrite-mode
[[ -n ${key[Home]} ]] && bindkey "${key[Home]}" beginning-of-line
[[ -n ${key[PageUp]} ]] && bindkey "${key[PageUp]}" up-line-or-history
[[ -n ${key[Delete]} ]] && bindkey "${key[Delete]}" delete-char
[[ -n ${key[End]} ]] && bindkey "${key[End]}" end-of-line
[[ -n ${key[PageDown]} ]] && bindkey "${key[PageDown]}" down-line-or-history
[[ -n ${key[Up]} ]] && bindkey "${key[Up]}" up-line-or-search
[[ -n ${key[Left]} ]] && bindkey "${key[Left]}" backward-char
[[ -n ${key[Down]} ]] && bindkey "${key[Down]}" down-line-or-search
[[ -n ${key[Right]} ]] && bindkey "${key[Right]}" forward-char
# Fix ctrl+r in tmux
if [ -n "$TMUX" ]; then
bindkey '^R' history-incremental-search-backward
fi
# Set (SVN) Editor to vim
export SVN_EDITOR=vim
export EDITOR=vim
# Aliases
alias ls="ls --color"
alias opentcp='sudo iptables -A INPUT -j ACCEPT -p tcp --dport'
alias openudp='sudo iptables -A INPUT -j ACCEPT -p udp --dport'
# http://unix.stackexchange.com/a/51908/13384
alias sudo='nocorrect sudo'
# Add ruby gems and my bin folder to path
export PATH="$PATH:/home/`whoami`/bin:/home/`whoami`/bin/scripts:/var/lib/gems/1.8/bin"
# Terminal calculator
calc(){ awk "BEGIN{ print $* }" ;}
# Load other files
source ~/.zsh/functions
# Fortune
fortune -c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment