Skip to content

Instantly share code, notes, and snippets.

@KevinBatdorf
Last active August 12, 2018 12:42
Show Gist options
  • Save KevinBatdorf/7f53d9cded6d9df3d7cd927738f4f940 to your computer and use it in GitHub Desktop.
Save KevinBatdorf/7f53d9cded6d9df3d7cd927738f4f940 to your computer and use it in GitHub Desktop.
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
# ZSH_THEME="robbyrussell"
ZSH_THEME="robbyrussell"
# 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)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
git
history
colorize
wd
HTTPie
zsh-autosuggestions
zsh-syntax-highlighting
)
# Do not record an event starting with a space
setopt HIST_IGNORE_SPACE
# Share history between sessions
setopt SHARE_HISTORY
# Write to the history file immediately, not when the shell exits
setopt INC_APPEND_HISTORY
# Auto changes to a directory without typing "cd"
setopt AUTO_CD
source $ZSH/oh-my-zsh.sh
# User configuration
export SSH_KEY_PATH="~/.ssh/rsa_id"
export PATH=/usr/local/bin:$PATH
# This loads nvm
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
# Composer stuff
export PATH="$PATH:$HOME/.composer/vendor/bin"
# load pure prompt theme
autoload -U promptinit; promptinit
prompt pure
# mkdir and go into it
mkcd (){ mkdir -p "$*";cd "$*";}
# run vagrant commands via homestead
function hs() {
( cd ~/Homestead && vagrant $* )
}
# ssh into vagrant
alias vm="homestead ssh"
# Lazy Git Commit
function lg() {
git status -s
git add .
git commit -a -m "$1"
git push
}
alias nah="git reset --hard && git clean -df"
# Completion for the `wp` command
autoload bashcompinit
bashcompinit
_wp_complete() {
local OLD_IFS="$IFS"
local cur=${COMP_WORDS[COMP_CWORD]}
IFS=$'\n'; # want to preserve spaces at the end
local opts="$(wp cli completions --line="$COMP_LINE" --point="$COMP_POINT")"
if [[ "$opts" =~ \<file\>\s* ]]
then
COMPREPLY=( $(compgen -f -- $cur) )
elif [[ $opts = "" ]]
then
COMPREPLY=( $(compgen -f -- $cur) )
else
COMPREPLY=( ${opts[*]} )
fi
IFS="$OLD_IFS"
return 0
}
complete -o nospace -F _wp_complete wp
# rsync shortcut
function rs() {
rsync -avz -e ssh $1 $2
}
# Dump homestead databases
alias dumpdb="mysqldump -u homestead -psecret --all-databases > ~/code/homestead.sql"
alias loaddb="mysql -u homestead -psecret < ~/code/homestead.sql"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment