10 changed files with 233 additions and 127 deletions
			
			
		@ -0,0 +1,19 @@
					 | 
				
			||||
# ZSH Configuration | 
				
			||||
 | 
				
			||||
The ZSH configuration is completely modularized to make management easier. The following are brief descriptions of each | 
				
			||||
file: | 
				
			||||
 | 
				
			||||
* `zshrc`: The main ZSH configuration sourced for non-login interactive terminals. | 
				
			||||
* `zprofile`: The main ZSH configuration sourced for login interactive terminals. Also sources `zshrc`. | 
				
			||||
* `functions.zsh`: A file containing function definitions for utilities. | 
				
			||||
* `aliases.zsh`: A file containing aliases sourced into the terminal. | 
				
			||||
* `exports.zsh`: A file containing all exports not found in `zprofile`.  | 
				
			||||
* `initializations.zsh`: A file containing initialization code for various tasks such as RVM directories, pyenv, etc. | 
				
			||||
* `ps1.zsh`: Defines the terminal prompt. | 
				
			||||
 | 
				
			||||
## Git Completion | 
				
			||||
 | 
				
			||||
Git completion is automatically installed on first run to `.zsh` in the users home. This is all created for you and nothing | 
				
			||||
needs to be done. Should the curl commands fail to pull the correct files from the `git` github repository you will need | 
				
			||||
to source both `git-completion.bash` and `git-completion.zsh` and adjust the script appropriately or place them in a  | 
				
			||||
`.zsh` directory in `$HOME`. | 
				
			||||
@ -0,0 +1,41 @@
					 | 
				
			||||
# Alias | 
				
			||||
if [[ "$OS_TYPE" != "gnu-linux" ]]; then | 
				
			||||
  alias python='python3' | 
				
			||||
fi | 
				
			||||
 | 
				
			||||
# rlwrap provides readline wrapping for programs. | 
				
			||||
# This alias makes the SBCL REPL usable. | 
				
			||||
alias sbcl='rlwrap sbcl' | 
				
			||||
 | 
				
			||||
# Useful git aliases | 
				
			||||
alias gita='git add' | 
				
			||||
alias gitap='git add -p' | 
				
			||||
alias gitc='git commit' | 
				
			||||
alias gitp='git push' | 
				
			||||
alias gits='git status' | 
				
			||||
alias gitd='git diff' | 
				
			||||
 | 
				
			||||
alias k8='kubectl' | 
				
			||||
 | 
				
			||||
# Good overrides | 
				
			||||
 | 
				
			||||
# Don't nuke the computer | 
				
			||||
alias rm='rm -i' | 
				
			||||
 | 
				
			||||
# Better ls - lists more information for each file | 
				
			||||
alias ll='ls -lh' | 
				
			||||
 | 
				
			||||
# Human readable ls for the current directory | 
				
			||||
if [[ "$OS_TYPE" != "gnu-linux" ]]; then | 
				
			||||
    # OS X lt | 
				
			||||
    alias lt='du -sh * | sort -h' | 
				
			||||
else | 
				
			||||
    alias lt='ls --human-readable --size -1 -S --classify' | 
				
			||||
fi | 
				
			||||
 | 
				
			||||
 | 
				
			||||
# Count files in the current directory | 
				
			||||
alias count='find . -type f | wc -l' | 
				
			||||
 | 
				
			||||
# Generate sha1 hashes on the fly | 
				
			||||
alias sha1='openssl sha1' | 
				
			||||
@ -0,0 +1,33 @@
					 | 
				
			||||
#!/bin/zsh | 
				
			||||
 | 
				
			||||
if hash vim 2>/dev/null; then | 
				
			||||
	export EDITOR=vim | 
				
			||||
else | 
				
			||||
	export EDITOR=vi | 
				
			||||
fi | 
				
			||||
 | 
				
			||||
if hash clang 2>/dev/null; then | 
				
			||||
	export CC=$(which clang) | 
				
			||||
else | 
				
			||||
	export CC=$(which gcc) | 
				
			||||
fi | 
				
			||||
 | 
				
			||||
if hash clang++ 2>/dev/null; then | 
				
			||||
	export CXX=$(which clang++) | 
				
			||||
else | 
				
			||||
	export CXX=$(which g++) | 
				
			||||
fi | 
				
			||||
 | 
				
			||||
export OPENSSL_ROOT_DIR=$(which openssl) | 
				
			||||
 | 
				
			||||
# Add openJDK to path | 
				
			||||
export PATH="/usr/local/opt/openjdk/bin:$PATH" | 
				
			||||
 | 
				
			||||
# Ignore duplicates in history to make history less of a hassle to use. | 
				
			||||
export HISTCONTROL=ignoredups | 
				
			||||
 | 
				
			||||
# If go is installed, set the $GOPATH to the projects directory created above. | 
				
			||||
if which go > /dev/null; then export GOPATH=$HOME/.go; fi | 
				
			||||
	 | 
				
			||||
export PATH="$PATH:$HOME/.rvm/bin" | 
				
			||||
. "$HOME/.cargo/env" | 
				
			||||
@ -0,0 +1,12 @@
					 | 
				
			||||
#!/usr/zsh | 
				
			||||
 | 
				
			||||
parse_git_branch() { | 
				
			||||
    git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1) /' | 
				
			||||
} | 
				
			||||
 | 
				
			||||
# If you ever needed weather... | 
				
			||||
weather() { | 
				
			||||
    curl wttr.in | 
				
			||||
} | 
				
			||||
 | 
				
			||||
 | 
				
			||||
@ -0,0 +1,17 @@
					 | 
				
			||||
#!/bin/zsh | 
				
			||||
 | 
				
			||||
if [[ "$OSTYPE" == "linux-gnu" ]]; then | 
				
			||||
  export PATH="$HOME/.pyenv/bin:$PATH" | 
				
			||||
 | 
				
			||||
	# For whatever reason the linux version of pyenv doesnt install `pyenv-virtualenv-init`. | 
				
			||||
	eval "$(pyenv init -)" | 
				
			||||
	eval "$(pyenv virtualenv-init -)" | 
				
			||||
fi | 
				
			||||
 | 
				
			||||
if which pyenv-virtualenv-init > /dev/null; then | 
				
			||||
	eval "$(pyenv init -)" | 
				
			||||
	eval "$(pyenv virtualenv-init -)" | 
				
			||||
fi | 
				
			||||
 | 
				
			||||
# RVM configuration | 
				
			||||
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" | 
				
			||||
@ -0,0 +1,10 @@
					 | 
				
			||||
#!/bin/zsh | 
				
			||||
 | 
				
			||||
setopt prompt_subst | 
				
			||||
autoload -Uz vcs_info  | 
				
			||||
precmd () { vcs_info } | 
				
			||||
 | 
				
			||||
# Format = [<branch>]  | 
				
			||||
zstyle ':vcs_info:*' formats ' %F{green}[%b]%f' | 
				
			||||
 | 
				
			||||
PS1='%B%n@%m%b %F{blue}%2~%f${vcs_info_msg_0_} %B⇨%b ' | 
				
			||||
@ -0,0 +1,26 @@
					 | 
				
			||||
#!/bin/zsh | 
				
			||||
 | 
				
			||||
if [[ -f ~/.zshrc ]]; then | 
				
			||||
  source ~/.zshrc | 
				
			||||
fi | 
				
			||||
 | 
				
			||||
if [[ "$OSTYPE" == "darwin"* ]]; then | 
				
			||||
  # Enable homebrew openssl support | 
				
			||||
  export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/ | 
				
			||||
  export PATH="/usr/local/opt/openjdk/bin:$PATH" | 
				
			||||
  export PATH="/usr/local/opt/llvm/bin:$PATH" | 
				
			||||
  export PATH="/usr/local/opt/qt/bin:$PATH" | 
				
			||||
  export PATH="/usr/local/opt/tcl-tk/bin:$PATH" | 
				
			||||
fi | 
				
			||||
 | 
				
			||||
if hash pyenv 2>/dev/null; then | 
				
			||||
  export PYENV_ROOT="$HOME/.pyenv" | 
				
			||||
  command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH" | 
				
			||||
  eval "$(pyenv init -)" | 
				
			||||
fi | 
				
			||||
 | 
				
			||||
# Local bin  | 
				
			||||
export PATH=$HOME/bin:/usr/local/bin:$PATH | 
				
			||||
 | 
				
			||||
test -r /home/vm/.opam/opam-init/init.sh && . /home/vm/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true | 
				
			||||
. "$HOME/.cargo/env" | 
				
			||||
@ -0,0 +1,75 @@
					 | 
				
			||||
#!/bin/zsh | 
				
			||||
 | 
				
			||||
if [[ "$OSTYPE" == "linux-gnu" ]]; then | 
				
			||||
  symlink_dir=$(cd "$( dirname "`readlink -f ${(%):-%N}`" )" && pwd) | 
				
			||||
else | 
				
			||||
  # OS X is not a fan of `readlink -f` | 
				
			||||
  symlink_dir=$(cd "$( dirname "`readlink ${(%):-%N}`" )" && pwd) | 
				
			||||
fi | 
				
			||||
 | 
				
			||||
# -------------------------------- SETUP -------------------------------- # | 
				
			||||
 | 
				
			||||
# Store private information (exports, keys, etc) in .bash_private. | 
				
			||||
if [[ -f $HOME/.bash_private ]]; then | 
				
			||||
  source $HOME/.bash_private | 
				
			||||
  echo ".bash_private loaded" | 
				
			||||
fi | 
				
			||||
 | 
				
			||||
# Or alternatively .private... | 
				
			||||
if [[ -f $HOME/.private ]]; then | 
				
			||||
  source $HOME/.private | 
				
			||||
  echo ".private loaded" | 
				
			||||
fi | 
				
			||||
 | 
				
			||||
if [ -f $HOME/.inputrc ]; then | 
				
			||||
        source $HOME/.inputrc | 
				
			||||
else | 
				
			||||
        echo "No .inputrc detected" | 
				
			||||
fi | 
				
			||||
 | 
				
			||||
if [[ "$OSTYPE" == "darwin"* ]]; then | 
				
			||||
  if [ -f $HOME/.macrc ]; then | 
				
			||||
          source $HOME/.macrc | 
				
			||||
  fi | 
				
			||||
fi | 
				
			||||
 | 
				
			||||
# Set up projects and gopath folder properly for the export in the export section. | 
				
			||||
 | 
				
			||||
if [[ ! -d $HOME/projects ]]; then | 
				
			||||
  echo "Making $HOME/projects" | 
				
			||||
  mkdir -p $HOME/projects | 
				
			||||
fi | 
				
			||||
 | 
				
			||||
if [[ -x go ]]; then | 
				
			||||
  echo "Making $HOME/.go" | 
				
			||||
  mkdir -p $HOME/.go | 
				
			||||
fi | 
				
			||||
 | 
				
			||||
 | 
				
			||||
# Install zsh completion in ~/.zsh if it doesn't exist | 
				
			||||
if [[ ! -d $HOME/.zsh ]]; then | 
				
			||||
  echo "Installing zsh git completion scripts" | 
				
			||||
  mkdir -p $HOME/.zsh | 
				
			||||
  cd $HOME/.zsh | 
				
			||||
 | 
				
			||||
  curl -o git-completion.bash https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash | 
				
			||||
  curl -o _git https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.zsh | 
				
			||||
 | 
				
			||||
  cd $HOME | 
				
			||||
fi | 
				
			||||
 | 
				
			||||
zstyle ':completion:*:*:git:*' script $HOME/.zsh/git-completion.bash | 
				
			||||
fpath=(~/.zsh $fpath) | 
				
			||||
 | 
				
			||||
autoload -Uz compinit && compinit | 
				
			||||
 | 
				
			||||
 | 
				
			||||
# Pull in other configurations | 
				
			||||
source $symlink_dir/aliases.zsh | 
				
			||||
source $symlink_dir/functions.zsh | 
				
			||||
source $symlink_dir/exports.zsh | 
				
			||||
source $symlink_dir/initializations.zsh | 
				
			||||
source $symlink_dir/ps1.zsh | 
				
			||||
 | 
				
			||||
# ------------------------------ END SETUP ------------------------------ # | 
				
			||||
 | 
				
			||||
@ -1,118 +0,0 @@
					 | 
				
			||||
source ~/.bash_profile | 
				
			||||
 | 
				
			||||
#Portable across both mac and linux now | 
				
			||||
export LC_ALL=en_US.UTF-8 | 
				
			||||
export LANG=en_US.UTF-8 | 
				
			||||
if [[ "$OSTYPE" == "linux-gnu" ]]; then | 
				
			||||
  # Linux | 
				
			||||
  export VISUAL="nvim" | 
				
			||||
  alias vim="$VISUAL" | 
				
			||||
elif [[ "$OSTYPE" == "darwin"* ]]; then | 
				
			||||
  # Mac OSX | 
				
			||||
  export VISUAL="/usr/local/bin/nvim" | 
				
			||||
  alias vim="$VISUAL" | 
				
			||||
 | 
				
			||||
  # Give access to mono (if installed via the .pkg) early on | 
				
			||||
  export PATH=/Library/Frameworks/Mono.framework/Versions/Current/bin/:${PATH} | 
				
			||||
fi | 
				
			||||
export EDITOR="$VISUAL" | 
				
			||||
export ITERM_24BIT=1 | 
				
			||||
export TERM=xterm-256color | 
				
			||||
export GOPATH=$HOME/go | 
				
			||||
export GOBIN=$GOPATH/bin | 
				
			||||
export PATH=$PATH:$GOBIN | 
				
			||||
 | 
				
			||||
# TODO: PUT THIS IN AN IF PYENV EXISTS CHECK | 
				
			||||
eval "$(pyenv init -)" | 
				
			||||
 | 
				
			||||
# Emacs needs to be setup different on Linux and Mac | 
				
			||||
if [[ "$OSTYPE" == "darwin"* ]]; then | 
				
			||||
    alias emacs='/Applications/Emacs.app/Contents/MacOS/Emacs -nw' | 
				
			||||
else | 
				
			||||
    alias emacs='emacs -nw' | 
				
			||||
fi | 
				
			||||
 | 
				
			||||
alias irssi='TERM=screen-256color irssi' | 
				
			||||
alias scheme='rlwrap mit-scheme' | 
				
			||||
alias startpg='pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start' | 
				
			||||
alias stoppg='pg_ctl -D /usr/local/var/postgres stop' | 
				
			||||
 | 
				
			||||
# This is for the mac GUI version of emacs. | 
				
			||||
alias emacs-gui='open -a /Applications/Emacs.app $1' | 
				
			||||
 | 
				
			||||
# Git specific aliases | 
				
			||||
alias gp='git push' | 
				
			||||
alias gs='git status' | 
				
			||||
alias gd='git diff' | 
				
			||||
alias gc='git commit -v' | 
				
			||||
alias gb='git branch' | 
				
			||||
alias gbd='git branch -d' | 
				
			||||
alias gbdd='git branch -D' | 
				
			||||
alias gpu='git pull' | 
				
			||||
alias gm='git merge' | 
				
			||||
alias gf='git fetch' | 
				
			||||
alias ga='git add .' | 
				
			||||
 | 
				
			||||
gblame() { | 
				
			||||
  builtin git blame $1 | 
				
			||||
} | 
				
			||||
 | 
				
			||||
parse_git_branch() { | 
				
			||||
    git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | 
				
			||||
} | 
				
			||||
 | 
				
			||||
HISTFILE=~/.histfile | 
				
			||||
HISTSIZE=10000 | 
				
			||||
SAVEHIST=10000 | 
				
			||||
 | 
				
			||||
autoload -U colors && colors | 
				
			||||
autoload -U promptinit | 
				
			||||
autoload -U compinit && compinit | 
				
			||||
autoload -Uz vcs_info | 
				
			||||
zstyle ':completion:*' menu select | 
				
			||||
zstyle ':vcs_info:git*' formats "%{$fg[white]%}[%{$reset_color%}%{$fg[blue]%}%b%{$fg[white]%}]%{$reset_color%} %a" | 
				
			||||
 | 
				
			||||
promptinit | 
				
			||||
plugins=(git brew npm coffee) | 
				
			||||
 | 
				
			||||
# User configuration | 
				
			||||
if [[ "$OSTYPE" == "darwin"* ]]; then | 
				
			||||
  export MYSQL_PATH=/usr/local/Cellar/mysql/5.6.27 | 
				
			||||
  export PATH=$PATH:$MYSQL_PATH/bin | 
				
			||||
 | 
				
			||||
  # Brew | 
				
			||||
  export PATH=$PATH:/usr/local/bin | 
				
			||||
 | 
				
			||||
  # Haskell stuff | 
				
			||||
  export PATH=~/.cabal/bin:$PATH | 
				
			||||
  export PATH=.cabal-sandbox/bin:$PATH | 
				
			||||
 | 
				
			||||
  # Groovy | 
				
			||||
  export GROOVY_HOME=/usr/local/opt/groovy/libexec | 
				
			||||
 | 
				
			||||
  # Gradle | 
				
			||||
  export GRADLE_HOME=/usr/local/opt/gradle/4.5/libexec | 
				
			||||
  export PATH=$PATH:/usr/local/opt/gradle/4.5/libexec | 
				
			||||
 | 
				
			||||
fi | 
				
			||||
 | 
				
			||||
precmd(){ | 
				
			||||
  vcs_info | 
				
			||||
} | 
				
			||||
 | 
				
			||||
# Set up custom prompt | 
				
			||||
setopt PROMPT_SUBST | 
				
			||||
 | 
				
			||||
RPROMPT="%{$fg[white]%}\${vcs_info_msg_0_}%{$reset_color%}" | 
				
			||||
 | 
				
			||||
PROMPT="%{$fg[white]%}┌%{$reset_color%}[%{$fg[yellow]%}%n%{$reset_color%}@%{$fg[cyan]%}%m%{$reset_color%}]─[%{$fg[green]%}%d%{$reset_color%}] | 
				
			||||
%{$fg[white]%}└─╼%{$reset_color%} " | 
				
			||||
 | 
				
			||||
# Run opam init | 
				
			||||
if hash opam 2>/dev/null; then | 
				
			||||
  ~/.opam/opam-init/init.sh  > /dev/null 2> /dev/null || true | 
				
			||||
  eval `opam config env` | 
				
			||||
fi | 
				
			||||
 | 
				
			||||
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting | 
				
			||||
export PATH="/usr/local/opt/cython/bin:$PATH" | 
				
			||||
					Loading…
					
					
				
		Reference in new issue