Skip to content

Instantly share code, notes, and snippets.

@NickWoodhams
Created August 27, 2015 03:47
Show Gist options
  • Save NickWoodhams/94919631f126072b9391 to your computer and use it in GitHub Desktop.
Save NickWoodhams/94919631f126072b9391 to your computer and use it in GitHub Desktop.
Dotfile for command line. Jump and go are pretty awesome.
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
ZSH_THEME="pure"
# Aliases
alias pyc='find . -name "*.pyc" -exec rm -rf {} \;'
alias v="source venv/bin/activate"
alias extra="sudo sh /Users/nick/Dropbox/Automation/copy-extra-settings-manually.sh"
alias a="sudo apachectl graceful"
alias n="sudo nginx -s stop && sudo nginx;"
alias lsd='ls -l | grep "^d"'
alias up="alembic revision --autogenerate; alembic upgrade head;"
alias fact="elinks -dump randomfunfacts.com | sed -n '/^| /p' | tr -d \|"
alias sub="subl `pwd`"
alias ipy='ipython qtconsole --ConsoleWidget.font_family="Consolas" --ConsoleWidget.font_size=13'
alias s="source ~/.zshrc"
alias z="subl ~/.zshrc"
alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'"
alias ipy='ipython qtconsole --ConsoleWidget.font_family="Consolas" --ConsoleWidget.font_size=13'
alias s="source ~/.zshrc"
alias z="subl ~/.zshrc"
alias p="/Users/nick/Dropbox/Automation/pwd.py"
alias flush="dscacheutil -flushcache"
alias spotify="osascript /Users/nick/Dropbox/Automation/SpotifyControl/SpotifyControl.scpt"
alias s="osascript /Users/nick/Dropbox/Automation/SpotifyControl/SpotifyControl.scpt"
alias fuck='eval $(thefuck $(fc -ln -1 | tail -n 1)); fc -R'
# Create an alias that will execute ‘docker ps -l -q’ and
# return the last-run container ID. This convenience method
# will not work on Docker hosts that serve multiple users.
alias dlc='docker ps -l -q'
# Create an alias that will execute
# 'docker ps -a | grep Exited | awk '{print $1}' | xargs docker rm'
# and remove all stopped containers.
alias drm="docker ps -a | grep Exited | cut -d ' ' -f 1 | xargs docker rm"
# Set to this to use case-sensitive completion
# CASE_SENSITIVE="true"
# Uncomment this to disable bi-weekly auto-update checks
# DISABLE_AUTO_UPDATE="true"
# Uncomment to change how often before auto-updates occur? (in days)
# export UPDATE_ZSH_DAYS=13
# Uncomment following line if you want to disable colors in ls
# DISABLE_LS_COLORS="true"
# Uncomment following line if you want to disable autosetting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment following line if you want to disable command autocorrection
DISABLE_CORRECTION="false"
# Uncomment following line if you want red dots to be displayed while waiting for completion
# COMPLETION_WAITING_DOTS="true"
# Uncomment following line if you want to disable marking untracked files under
# VCS as dirty. This makes repository status check for large repositories much,
# much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git osx)
source $ZSH/oh-my-zsh.sh
# Autocomplete SSH Aliases
complete -o default -o nospace -W "$(/usr/bin/ruby -ne 'puts $_.split(/[\s,]+/)[1..-1].reject { |h| h.match /\*|\?/ } if $_.match /^\s*Host[s]*\s+/' < ~/.ssh/config)" scp sftp ssh 2>/dev/null
#jump function
export MARKPATH=$HOME/.marks
function jump {
cd -P "$MARKPATH/$1" 2>/dev/null || echo "No such mark: $1"
}
function go {
cd -P "$MARKPATH/$1" 2>/dev/null || echo "No such mark: $1"
}
function mark {
mkdir -p "$MARKPATH"; ln -s "$(command pwd)" "$MARKPATH/$1"
}
function unmark {
rm -i "$MARKPATH/$1"
}
function marks {
\ls -l "$MARKPATH" | tail -n +2 | sed 's/ / /g' | cut -d' ' -f9- | awk -F ' -> ' '{printf "%-10s -> %s\n", $1, $2}'
}
function _completemarks {
reply=($(ls "$MARKPATH"))
}
#
compctl -K _completemarks jump
compctl -K _completemarks go
compctl -K _completemarks unmark
function make_dir() {
mkdir $1 && cd $1
}
alias mkd='make_dir'
# CREATE DIRECTORY THEN GO INTO IT
cd_and_ls() {
cd $1
ls
}
alias cd='cd_and_ls'
# PATH INFO
export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin
export PATH=/Applications/Postgres.app/Contents/Versions/9.4/bin:$PATH
export PATH=/usr/local/mysql/bin:$PATH
export PATH="$HOME/Dropbox/Automation/bin":$PATH
export PATH="/Library/Frameworks/Python.framework/Versions/Current/Resources/bin":$PATH
export PATH="$HOME/.rbenv/bin:$PATH":$PATH
#export PATH=/Library/Developer/CommandLineTools/usr/bin:$PATH
# Docker Vars
export DOCKER_HOST=tcp://192.168.59.103:2376
export DOCKER_CERT_PATH=/Users/nick/.boot2docker/certs/boot2docker-vm
export DOCKER_TLS_VERIFY=1
# Virtualenv Wrapper
export VIRTUALENVWRAPPER_PYTHON=`which python`
export VIRTUALENVWRAPPER_VIRTUALENV=`which virtualenv`
source `which virtualenvwrapper.sh`
### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment