From 5b1ba618e57c9d9c8d63c6c2544191c892b4a37b Mon Sep 17 00:00:00 2001 From: brettlangdon Date: Wed, 23 Nov 2016 11:40:34 -0500 Subject: [PATCH] Configure zshrc.d directory/files --- .gitignore | 1 + zshrc | 87 +++------------------------------------ zshrc.d/.env.zsh | 45 ++++++++++++++++++++ zshrc.d/bootstrap.zsh | 11 +++++ zshrc.d/lib/aliases.sh | 3 ++ zshrc.d/lib/functions.zsh | 34 +++++++++++++++ 6 files changed, 100 insertions(+), 81 deletions(-) create mode 100644 zshrc.d/.env.zsh create mode 100644 zshrc.d/bootstrap.zsh create mode 100644 zshrc.d/lib/aliases.sh create mode 100644 zshrc.d/lib/functions.zsh diff --git a/.gitignore b/.gitignore index 5feebda..2581353 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ config/inkscape config/keybase/ config/netfabb/ config/pudb/ +zshrc.d/.env.*.zsh diff --git a/zshrc b/zshrc index c55eeaa..7ddb75c 100644 --- a/zshrc +++ b/zshrc @@ -1,84 +1,9 @@ -#!/usr/bin/env bash -export LC_ALL=en_US.UTF-8 -export LANG=en_US.UTF-8 +#!/usr/bin/env zsh +unsetopt inc_append_history share_history +setopt NO_BEEP histignorealldups -# Configure emacs as default editor -export GIT_EDITOR="emacs -nw -Q" -export VISUAL="emacs" -export EDITOR="emacs" +export ZSH_DIR=${ZSH_DIR:-$HOME/.zshrc.d} +source ${ZSH_DIR}/bootstrap.zsh -PATH="/usr/local/bin:/usr/local/sbin:/sbin:$PATH" -export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH:~/.local/bin" - -# Configure oh-my-zsh -export TERM="xterm-256color" -ZSH=${HOME}/.oh-my-zsh -ZSH_THEME="agnoster" -DISABLE_AUTO_UPDATE="true" -COMPLETION_WAITING_DOTS="true" -# DEV: `pip` and `nvm` are very slow to load -plugins=(brew git git-extras python node npm fabric) - -test -e ${ZSH}/oh-my-zsh.sh && source ${ZSH}/oh-my-zsh.sh -unsetopt inc_append_history -unsetopt share_history # share command history data - -# Setup Go -export GOPATH=~/go -export PATH="$PATH:$GOPATH/bin" - -export MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH" -export NODE_PATH=/usr/local/lib/node_modules -export ACK_PAGER_COLOR="less -x4SRFX" - -# Setup Python/Virtualenv -export WORKON_HOME=~/.env -export PYTHONDONTWRITEBYTECODE=1 -load_virtualenv () { - source /usr/local/bin/virtualenvwrapper.sh -} -workon () { - load_virtualenv - workon "$@" -} -mkvirtualenv () { - load_virtualenv - mkvirtualenv "$@" -} -rmvirtualenv () { - load_virtualenv - rmvirtualenv "$@" -} - - -# Setup custom aliases -alias up="vagrant up && vagrant ssh" -alias stayawake="caffeinate -s -d -i" -alias emacs="emacs -nw" - -### Added by the Heroku Toolbelt -export PATH="/usr/local/heroku/bin:$PATH" - -# Setup RVM -export PATH="$HOME/.rvm/bin:$PATH" # Add RVM to PATH for scripting -export rvm_project_rvmrc=1 -rvm () { - source ${HOME}/.rvm/scripts/rvm - rvm "$@" -} - -# Setup NVM -export NVM_DIR=~/.nvm -nvm () { - source $(brew --prefix nvm)/nvm.sh - nvm "$@" -} - -# Setup iterm2 shell integration +# # Setup iterm2 shell integration test -e ${HOME}/.iterm2_shell_integration.zsh && source ${HOME}/.iterm2_shell_integration.zsh - -# Init chef -chef () { - eval "$(chef shell-init zsh)" - chef "$@" -} diff --git a/zshrc.d/.env.zsh b/zshrc.d/.env.zsh new file mode 100644 index 0000000..77dcdc9 --- /dev/null +++ b/zshrc.d/.env.zsh @@ -0,0 +1,45 @@ +export LC_ALL=en_US.UTF-8 +export LANG=en_US.UTF-8 +export TERM="xterm-256color" +export ACK_PAGER_COLOR="less -x4SRFX" + +# Configure emacs as default editor +# Configure emacs as default editor +export GIT_EDITOR="emacs -nw -Q" +export VISUAL="emacs" +export EDITOR="emacs" + +# Configure Go +export GOPATH=~/go + +# Configure virtualenv +export WORKON_HOME=~/.env +export PYTHONDONTWRITEBYTECODE=1 + +# Configure ZSH +export ZSH=$ZSH_DIR/oh-my-zsh +export ZSH_THEME="agnoster" +export DISABLE_AUTO_UPDATE="true" +export COMPLETION_WAITING_DOTS="true" +# DEV: `pip` and `nvm` are very slow to load +export plugins=(git git-extras python node npm fabric) + +# Configure RVM +export rvm_project_rvmrc=1 + +# Configure NVM +export NVM_DIR=~/.nvm + +# Configure Path +PATH="/usr/local/bin:/usr/local/sbin:/sbin:$PATH" +PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH:~/.local/bin" +PATH="$PATH:$GOPATH/bin" +PATH="/usr/local/heroku/bin:$PATH" +export PATH="$HOME/.rvm/bin:$PATH" +export MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH" + +# TODO: Load in any extra environments +for f in $(find $ZSH_DIR/ -print -type f -maxdepth 1 | grep '\.env\..*\.zsh' | sort) +do + source "$f" +done diff --git a/zshrc.d/bootstrap.zsh b/zshrc.d/bootstrap.zsh new file mode 100644 index 0000000..df9578f --- /dev/null +++ b/zshrc.d/bootstrap.zsh @@ -0,0 +1,11 @@ +# Load in custom functions +source ${ZSH_DIR}/lib/functions.zsh + +# Load in aliases +source ${ZSH_DIR}/lib/aliases.sh + +# Load in base environment variables +source ${ZSH_DIR}/.env.zsh + +# Load in oh-my-zsh +source ${ZSH}/oh-my-zsh.sh diff --git a/zshrc.d/lib/aliases.sh b/zshrc.d/lib/aliases.sh new file mode 100644 index 0000000..57c252c --- /dev/null +++ b/zshrc.d/lib/aliases.sh @@ -0,0 +1,3 @@ +alias up="vagrant up && vagrant ssh" +alias stayawake="caffeinate -s -d -i" +alias emacs="emacs -nw" diff --git a/zshrc.d/lib/functions.zsh b/zshrc.d/lib/functions.zsh new file mode 100644 index 0000000..727c3d0 --- /dev/null +++ b/zshrc.d/lib/functions.zsh @@ -0,0 +1,34 @@ +# Setup Python/Virtualenv +load_virtualenv () { + source /usr/local/bin/virtualenvwrapper.sh +} +workon () { + load_virtualenv + workon "$@" +} +mkvirtualenv () { + load_virtualenv + mkvirtualenv "$@" +} +rmvirtualenv () { + load_virtualenv + rmvirtualenv "$@" +} + +# Setup RVM +rvm () { + source ${HOME}/.rvm/scripts/rvm + rvm "$@" +} + +# Setup NVM +nvm () { + source $(brew --prefix nvm)/nvm.sh + nvm "$@" +} + +# Init chef +chef () { + eval "$(chef shell-init zsh)" + chef "$@" +}