Skip to content

Instantly share code, notes, and snippets.

@wisq
Created December 21, 2011 22:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save wisq/1507942 to your computer and use it in GitHub Desktop.
Save wisq/1507942 to your computer and use it in GitHub Desktop.
My zshrc & zshenv
# Custom PATH to avoid every utility prepending more duplicate entries to it:
export PATH="$HOME/bin:$HOME/.rbenv/shims:$HOME/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
# RVM:
#. "$HOME/.rvm/scripts/rvm"
#setopt noextendedglob # piss off RVM, I like my ^'s
# rbenv:
eval "`rbenv init -`"
. ~/.zshenv # Restore $PATH to my custom one
# Preferred utilities:
export EDITOR=`which vim`
export VISUAL="$EDITOR"
export PAGER="$HOME/bin/pager"
export ACK_PAGER="$PAGER"
alias less="less -R"
alias man="LC_CTYPE=C man"
alias vi=vim
# Local aliases stored separately for easy reloading:
. ~/.aliases
# If running interactively:
if [ "$PS1" ]; then
# Create vim repositories:
mkdir -p ~/tmp/swap /tmp/$LOGNAME/backup
# Security checks:
chmod 0700 /tmp/$LOGNAME /tmp/$LOGNAME/backup
chown $LOGNAME --changes /tmp/$LOGNAME
# Colour ls:
eval `dircolors -b`
alias ls='ls --color=auto --classify --ignore=",,*"'
fi
# Nethack options, for both nethack and screen:
export NETHACKOPTIONS="$HOME/.nethackrc"
# whois options:
# Skip license crap.
export WHOIS_HIDE=1
# Keybindings:
# Emacs keybinding mode for bash-like behaviour.
bindkey -A emacs main
# Insert, delete, pageup, pagedown.
bindkey '\e[3~' delete-char
bindkey '\e[1~' beginning-of-line
bindkey '\e[4~' end-of-line
bindkey '\e[2~' overwrite-mode
# Standard prompt, but with % instead of $.
if [ "`whoami`" = "root" ]; then
export PROMPT="%n@%m:%~# "
else
export PROMPT="%n@%m:%~%% "
fi
# Options:
# Don't cycle completions.
setopt noautomenu
# Automatically update pushd/popd list...
setopt autopushd
# ... and don't duplicate them.
setopt pushdignoredups
# HUP processes on exit for SSH lockups. (Is this needed still?)
setopt hup
# Show types in completion.
setopt listtypes
# Make exclamation marks safe to use. I so rarely use 'events'.
setopt nobanghist
# Alternatively, confirm when using !.
#setopt histverify
# Also make equals safe to use. Never even knew about that.
setopt noequals
# Tell me if a command fails.
setopt printexitvalue
# Do a cd to commands that resolve to a directory. (Experiment.)
setopt autocd
# Tasks launched in the background don't need to be niced!
setopt nobgnice
# Notify me if something takes awhile.
REPORTTIME=1
# History options:
# Lines to keep, lines to save, where to save...
HISTSIZE=10000
SAVEHIST=$HISTSIZE
HISTFILE=~/.zsh_history
# ... but append, don't overwrite, and do it incrementally.
setopt incappendhistory
# Don't append duplicates.
setopt histignoredups
# Completion:
# Enable completion.
autoload -U compinit && compinit
# Load coloured completion.
zmodload zsh/complist 2> /dev/null
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
# Cache completions.
mkdir -p /tmp/$LOGNAME/zshcompl
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path /tmp/$LOGNAME/zshcompl
# Remove some chars from 'words' (e.g. alt-backspace) that I like.
# Essentially, add them as word delimiters.
# Currently: . /
WORDCHARS=${WORDCHARS:s,/,,}
WORDCHARS=${WORDCHARS:s,.,,}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment