Skip to content

Instantly share code, notes, and snippets.

@eropple
Last active August 29, 2015 14:26
Show Gist options
  • Save eropple/df6757cce1beb36a9940 to your computer and use it in GitHub Desktop.
Save eropple/df6757cce1beb36a9940 to your computer and use it in GitHub Desktop.
export DOTFILE_ROOT=/path/to/dotfile/root/dotfiles # I put them in Dropbox
source ${DOTFILE_ROOT}/zshrc-base.zsh
MAIN_COLOR=$fg[green]
SECONDARY_COLOR=$fg[cyan]
CAPPER_COLOR=$fg[yellow]
CAPPER=$
if [[ `id -u $USER` -eq 0 ]]
then
MAIN_COLOR=$fg[red]
SECONDARY_COLOR=$fg[yellow]
CAPPER=\#
fi
# PROMPT='[%{$MAIN_COLOR%}%n%{$SECONDARY_COLOR%}@%{$MAIN_COLOR%}%m%{$reset_color%} %{$SECONDARY_COLOR%}%~%{$reset_color%}$(git_prompt_info)%{$reset_color%}]$CAPPER_COLOR$CAPPER%{$reset_color%} '
PROMPT='[%{$MAIN_COLOR%}%n%{$SECONDARY_COLOR%}@%{$MAIN_COLOR%}%m%{$reset_color%} %{$SECONDARY_COLOR%}%~%{$reset_color%}$(git_prompt_info)%{$reset_color%}]%{$CAPPER_COLOR%}$CAPPER%{$reset_color%} '
ZSH_THEME_GIT_PROMPT_PREFIX=" (%{$MAIN_COLOR%}"
ZSH_THEME_GIT_PROMPT_SUFFIX=")"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$MAIN_COLOR%} %{$fg[yellow]%}✗%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$reset_color%}"
# Path to your oh-my-zsh installation.
export ZSH=$DOTFILE_ROOT/oh-my-zsh
if [[ `uname` == "Darwin" ]]
then
# TODO: detect actual OS version
export PLATFORM=MacOS
export PLATFORM_DETAILS=10.11
elif [[ `uname` == "Linux" ]]
then
# TODO: test for LSB/whatever to be specific about distro
export PLATFORM=Linux
export PLATFORM_DETAILS="Ubuntu"
elif [[ $(uname) == *CYGWIN* ]]
then
export PLATFORM=Windows
export PLATFORM_DETAILS="Cygwin"
fi
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="eropple"
# Example aliases
alias zshconfig="vim ~/.zshrc"
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to disable command auto-correction.
# DISABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"
# Uncomment the 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"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# 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)
export DISABLE_AUTO_UPDATE=true
source $DOTFILE_ROOT/zshrc-plugins.zsh
# actually enables oh-my-zsh
source $ZSH/oh-my-zsh.sh
if [[ -d ~/bin ]]
then
export PATH=~/bin:$PATH
fi
if [[ -d ~/.rbenv ]]
then
export PATH=~/.rbenv/shims:~/.rbenv/bin:$PATH
fi
if [[ -d /usr/local/opt/coreutils/libexec/gnubin ]]
then
export PATH=/usr/local/opt/coreutils/libexec/gnubin:$PATH
fi
# loads rbenv if available
if which rbenv > /dev/null; then eval "$(rbenv init - zsh)"; fi
### User configuration
if [[ -f $DOTFILE_ROOT/zshrc-user.zsh ]]
then
source $DOTFILE_ROOT/zshrc-user.zsh
fi
#! /usr/bin/env zsh
PATH="$DOTFILE_ROOT/cygwin-bin:$PATH"
#! /usr/bin/env zsh
plugins=()
if [[ $PLATFORM == "MacOS" ]]; then plugins+=(osx); fi
`which brew > /dev/null`
if [[ $? -eq 0 ]]; then plugins+=(brew); fi
`which ruby > /dev/null`
if [[ $? -eq 0 ]]; then plugins+=(ruby); fi
`which gem > /dev/null`
if [[ $? -eq 0 ]]; then plugins+=(gem); fi
`which rvm > /dev/null`
if [[ $? -eq 0 ]]; then plugins+=(rvm); fi
`which mvn > /dev/null`
if [[ $? -eq 0 ]]; then plugins+=(mvn); fi
`which rsync > /dev/null`
if [[ $? -eq 0 ]]; then plugins+=(rsync); fi
`which sbt > /dev/null`
if [[ $? -eq 0 ]]; then plugins+=(sbt scala); fi
`which vagrant > /dev/null`
if [[ $? -eq 0 ]]; then plugins+=(vagrant); fi
`which yum > /dev/null`
if [[ $? -eq 0 ]]; then plugins+=(yum); fi
`which mosh > /dev/null`
if [[ $? -eq 0 ]]; then plugins+=(mosh); fi
`which git > /dev/null`
if [[ $? -eq 0 ]]; then plugins+=(git gitignore git-flow git-extras github); fi
`which hg > /dev/null`
if [[ $? -eq 0 ]]; then plugins+=(mercurial); fi
`which svn > /dev/null`
if [[ $? -eq 0 ]]; then plugins+=(svn svn-fast-info); fi
`which man > /dev/null`
if [[ $? -eq 0 ]]; then plugins+=(colored-man); fi
`which bower > /dev/null`
if [[ $? -eq 0 ]]; then plugins+=(bower); fi
`which cake > /dev/null`
if [[ $? -eq 0 ]]; then plugins+=(cake); fi
`which coffee > /dev/null`
if [[ $? -eq 0 ]]; then plugins+=(coffee); fi
`which npm > /dev/null`
if [[ $? -eq 0 ]]; then plugins+=(npm); fi
`which aws > /dev/null`
if [[ $? -eq 0 ]]; then plugins+=(aws); fi
`which ant > /dev/null`
if [[ $? -eq 0 ]]; then plugins+=(ant); fi
`which apt > /dev/null`
if [[ $? -eq 0 ]]; then plugins+=(debian); fi
# export MANPATH="/usr/local/man:$MANPATH"
export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
if [[ -n $SSH_CONNECTION ]]; then
export EDITOR='vim'
else
export EDITOR='mvim'
fi
# these make Mac keyboarding not terrible in a shell
bindkey '^[[3' delete-char # delete
bindkey '^[[H' beginning-of-line # home
bindkey '^[[F' end-of-line # end
bindkey '\e[3~' delete-char # delete
bindkey '\eOH' beginning-of-line # home
bindkey '\e[1~' beginning-of-line # home (some terms)
bindkey '\eOF' end-of-line # end
bindkey '\e[4~' end-of-line # end (some terms)
bindkey '\e[1;5D' backward-word # ctrl-left
bindkey '\e[1;5C' forward-word # ctrl-right
bindkey "\e\e[D" backward-word # alt-left
bindkey "\e\e[C" forward-word #alt-right
bindkey '^@' history-incremental-search-backward # ctrl-space
bindkey '^[ ' history-beginning-search-backward # ctrl-alt-space
# menu completion
zstyle ':completion:*' menu select
# forces >! and >>!
unsetopt clobber
# extended, prettier history
setopt extended_history
setopt inc_append_history
setopt hist_ignore_dups
setopt hist_expire_dups_first
# automatically appends directories to the push/pop list
setopt auto_pushd
DIRSTACKSIZE=500
alias dc='popd > /dev/null' # cd to change, dc to go back. \o/
setopt complete_in_word # Not just at the end
setopt always_to_end # When complete from middle, move cursor
setopt hist_verify # When using ! cmds, confirm first
setopt interactive_comments # Escape commands so I can use them later
setopt print_exit_value # Alert me if something's failed
(( ${+QT_XFT} )) || export QT_XFT=1
(( ${+GDK_USE_XFT} )) || export GDK_USE_XFT=1
alias ls='ls --color=auto'
# makes square braces work correctly in rake
alias rake='noglob rake'
if [[ $PLATFORM_DETAILS == "Cygwin" ]]
then
source "$DOTFILE_ROOT/zshrc-cygwin.zsh"
else
# type 'lm' to lock your Mac
alias lm='/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment