Created
May 26, 2016 01:33
-
-
Save lewdlime/d50df1c70a5cc2783b7b3c30c25bdd3c to your computer and use it in GitHub Desktop.
ZSH Configurations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# aliases | |
# vim: fdm=marker ff=unix ft=sh ss=4 ts=4 | |
# Aliases {{{ | |
alias cls=clear | |
# enable color support of ls and also add handy aliases | |
if [ -x /usr/bin/dircolors ]; then | |
test -r ${HOME}/.dircolors && eval "$(dircolors -b ${HOME}/.dircolors)" || eval "$(dircolors -b)" | |
alias ls='ls --color=auto' | |
alias grep='grep --color=auto' | |
alias fgrep='fgrep --color=auto' | |
alias egrep='egrep --color=auto' | |
fi | |
# Bash / ZSH specific aliases | |
TF_ALIAS=fuck | |
if [ -n "$ZSH_VERSION" ]; then | |
alias fuck='TF_CMD=$(TF_ALIAS=fuck PYTHONIOENCODING=utf-8 TF_SHELL_ALIASES=$(alias) thefuck $(fc -ln -1 | tail -n 1)) && eval $TF_CMD && print -s $TF_CMD' | |
alias zln='zmv -L' | |
alias zcp='zmv -C' | |
alias zshconfig="subl ${HOME}/.zshrc" | |
elif [ -n "$BASH_VERSION" ]; then | |
alias fuck='eval $(thefuck $(fc -ln -1)); history -r' | |
fi | |
# open files in TextWrangler | |
alias tw='open -a /Applications/TextWrangler.app' | |
# Java: Trang from jing-trang | |
if [[ -f /opt/java/trang.jar ]]; then | |
alias trang='java -jar /opt/java/trang.jar' | |
fi | |
# Java: Jing from jing-trang | |
if [[ -f /opt/java/jing.jar ]]; then | |
alias jing='java -jar /opt/java/jing.jar' | |
fi | |
# Java: DTDInst from jing-trang | |
if [[ -f /opt/java/dtdinst.jar ]]; then | |
alias dtdinst='java -jar /opt/java/dtdinst.jar' | |
fi | |
# Java: BFG repository cleaner tool | |
if [[ -f $(brew --prefix)/etc/jar/bfg-1.12.12.jar ]]; then | |
alias bfg='java -jar /usr/local/etc/jar/bfg-1.12.12.jar' | |
fi | |
# Java: Jing from jing-trang | |
if [[ -d /opt/saxon ]]; then | |
export CLASSPATH="${CLASSPATH}:.:/opt/saxon/saxon9-icu.jar:/opt/saxon/saxon9-sql.jar:/opt/saxon/saxon9pe-test.jar:/opt/saxon/saxon9pe.jar" | |
alias saxon='java com.saxonica.Transform' | |
alias xquery='java com.saxonica.Query' | |
#alias testdriver='java com.saxonica.testdriver.QT3TestDriverPE' | |
fi | |
if [[ -d /Applications/VLC.app ]]; then | |
alias vlc='/Applications/VLC.app/Contents/MacOS/VLC -I rc' | |
fi | |
# ln -s "/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl | |
#alias subl='/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl' | |
# }}} | |
GRC=`command grc` | |
if [ "$TERM" != dumb ] && [ -n GRC ]; then | |
alias colourify="$GRC -es --colour=auto" | |
alias configure='colourify ./configure' | |
alias diff='colourify diff' | |
alias make='colourify make' | |
alias gcc='colourify gcc' | |
alias g++='colourify g++' | |
alias as='colourify as' | |
alias gas='colourify gas' | |
alias ld='colourify ld' | |
alias netstat='colourify netstat' | |
alias ping='colourify ping' | |
alias traceroute='colourify /usr/sbin/traceroute' | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# zpreztorc - Lee Savide | |
# vim: ft=zsh fdm=marker ts=4 sw=4 | |
# General {{{ | |
# Set case-sensitivity for completion, history lookup, etc. | |
zstyle ':prezto:*:*' case-sensitive 'yes' | |
# Color output (auto set to 'no' on dumb terminals). | |
zstyle ':prezto:*:*' color 'yes' | |
# Set the Zsh modules to load (man zshmodules). | |
zstyle ':prezto:load' zmodule 'attr' 'stat' | |
# Set the Zsh functions to load (man zshcontrib). | |
zstyle ':prezto:load' zfunction 'zargs' 'zmv' | |
# }}} | |
# Prezto Modules {{{ | |
# The order matters. | |
zstyle ':prezto:load' pmodule \ | |
'environment' \ | |
'terminal' \ | |
'editor' \ | |
'archive' \ | |
'command-not-found' \ | |
'directory' \ | |
'emacs' \ | |
'gpg' \ | |
'git' \ | |
'history' \ | |
'homebrew' \ | |
'node' \ | |
'osx' \ | |
'perl' \ | |
'python' \ | |
'rails' \ | |
'ruby' \ | |
'screen' \ | |
'spectrum' \ | |
'ssh' \ | |
'terminal' \ | |
'tmux' \ | |
'gnu-utility' \ | |
'utility' \ | |
'completion' \ | |
'fasd' \ | |
'syntax-highlighting' \ | |
'history-substring-search' \ | |
'prompt' | |
# }}} | |
# Module Options {{{ | |
# Editor | |
# Set the key mapping style to 'emacs' or 'vi'. | |
zstyle ':prezto:module:editor' key-bindings 'vi' | |
# Auto convert .... to ../.. | |
zstyle ':prezto:module:editor' dot-expansion 'yes' | |
# Git | |
# Ignore submodules when they are 'dirty', 'untracked', 'all', or 'none'. | |
zstyle ':prezto:module:git:status:ignore' submodules 'all' | |
# GNU Utility | |
# Set the command prefix on non-GNU systems. | |
zstyle ':prezto:module:gnu-utility' prefix 'g' | |
# History Substring Search | |
# Set the query found color. | |
zstyle ':prezto:module:history-substring-search:color' found '' | |
# Set the query not found color. | |
zstyle ':prezto:module:history-substring-search:color' not-found '' | |
# Set the search globbing flags. | |
zstyle ':prezto:module:history-substring-search' globbing-flags '' | |
# Prompt | |
# Set the prompt theme to load. | |
# Setting it to 'random' loads a random theme. | |
# Auto set to 'off' on dumb terminals. | |
#zstyle ':prezto:module:prompt' theme 'agnoster' | |
#zstyle ':prezto:module:prompt' theme 'paradox' | |
zstyle ':prezto:module:prompt' theme 'sorin' | |
# Ruby | |
# Auto switch the Ruby version on directory change. | |
#zstyle ':prezto:module:ruby:chruby' auto-switch 'yes' | |
# Screen | |
# Auto start a session when Zsh is launched in a local terminal. | |
#zstyle ':prezto:module:screen:auto-start' local 'no' | |
# Auto start a session when Zsh is launched in a SSH connection. | |
#zstyle ':prezto:module:screen:auto-start' remote 'yes' | |
# SSH | |
# Set the SSH identities to load into the agent. | |
zstyle ':prezto:module:ssh:load' identities 'id_rsa' 'id_rsa2' 'id_github' | |
# Syntax Highlighting | |
# Set syntax highlighters. | |
# By default, only the main highlighter is enabled. | |
zstyle ':prezto:module:syntax-highlighting' highlighters \ | |
'main' \ | |
'brackets' \ | |
'pattern' \ | |
'cursor' \ | |
'root' | |
# Set syntax highlighting styles. | |
zstyle ':prezto:module:syntax-highlighting' styles \ | |
'builtin' 'bg=blue' \ | |
'command' 'bg=blue' \ | |
'function' 'bg=blue' | |
# Terminal | |
# Auto set the tab and window titles. | |
zstyle ':prezto:module:terminal' auto-title 'yes' | |
# Set the window title format. | |
zstyle ':prezto:module:terminal:window-title' format '%n@%m: %s' | |
# Set the tab title format. | |
zstyle ':prezto:module:terminal:tab-title' format '%m: %s' | |
# Tmux | |
# Auto start a session when Zsh is launched in a local terminal. | |
zstyle ':prezto:module:tmux:auto-start' local 'no' | |
# Auto start a session when Zsh is launched in a SSH connection. | |
zstyle ':prezto:module:tmux:auto-start' remote 'yes' | |
# Integrate with iTerm2. | |
zstyle ':prezto:module:tmux:iterm' integrate 'yes' | |
# }}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# zprofile - Lee Savide | |
# vim: ft=zsh fdm=marker ts=2 sw=2 | |
# Exports {{{ | |
# zprofile Exports {{{ | |
# Browser | |
if [[ "$OSTYPE" == darwin* ]]; then | |
export BROWSER="open" | |
fi | |
# Editors | |
export EDITOR="subl" | |
export VISUAL="mvim" | |
export PAGER="less" | |
# Language | |
if [[ -z "$LANG" ]]; then | |
export LANG="en_US.UTF-8" | |
fi | |
# Paths | |
# Ensure path arrays do not contain duplicates. | |
typeset -gU cdpath fpath mailpath path | |
# Set the the list of directories that cd searches. | |
# cdpath=( | |
# $cdpath | |
# ) | |
# Set the list of directories that Zsh searches for programs. | |
path=( | |
/usr/local/{bin,sbin} | |
$path | |
) | |
# Less | |
# Set the default Less options. | |
# Mouse-wheel scrolling has been disabled by -X (disable screen clearing). | |
# Remove -X and -F (exit if the content fits on one screen) to enable it. | |
export LESS="-g -i -M -R -S -w -z-4" | |
# Set the Less input preprocessor. | |
# Try both `lesspipe` and `lesspipe.sh` as either might exist on a system. | |
if (( $#commands[(i)lesspipe(|.sh)] )); then | |
export LESSOPEN="| /usr/bin/env $commands[(i)lesspipe(|.sh)] %s 2>&-" | |
fi | |
# Temporary Files | |
if [[ ! -d "$TMPDIR" ]]; then | |
export TMPDIR="/tmp/$LOGNAME" | |
mkdir -p -m 700 "$TMPDIR" | |
fi | |
TMPPREFIX="${TMPDIR%/}/zsh" | |
# }}} | |
export GPG_TTY=$(tty) | |
if [ -f "${HOME}/.gpg-agent-info" ]; then | |
. "${HOME}/.gpg-agent-info" | |
export GPG_AGENT_INFO | |
export SSH_AUTH_SOCK | |
fi | |
# Set UTF-8 for showing all characters, even if there"s no font for them | |
export LANG=en_US.UTF-8 | |
if [[ -n "$SSH_CONNECTION" ]]; then | |
export PINENTRY_USER_DATA="USE_CURSES=1" | |
fi | |
# Preferred editor for local and remote sessions | |
if [[ -n $SSH_CONNECTION ]]; then | |
export EDITOR="subl" | |
else | |
export EDITOR="mvim" | |
fi | |
# Compilation flags | |
export ARCHFLAGS="-arch x86_64" | |
# ssh | |
export SSH_KEY_PATH="${HOME}/.ssh/rsa_id" | |
# }}} | |
# }}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# zshrc - Lee Savide | |
# vim: ft=zsh fdm=marker ts=2 sw=2 | |
# zshrc {{{ | |
# Startup {{{ | |
export PATH="${PATH}:$(brew --prefix)/bin" | |
if brew command command-not-found-init > /dev/null; then eval "$(brew command-not-found-init)"; fi | |
# zprezto | |
unalias run-help | |
autoload run-help | |
# Source Prezto | |
if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then . "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"; fi | |
# }}} | |
# Aliases {{{ | |
[[ -f ${HOME}/.aliases ]] && . ${HOME}/.aliases | |
# ztn {{{ | |
fpath=( "$fpath[@]" "$HOME/.config/znt/zsh-navigation-tools" ) | |
autoload n-aliases n-cd n-env n-functions n-history n-kill n-list n-list-draw n-list-input n-options n-panelize n-help | |
autoload znt-usetty-wrapper znt-history-widget znt-cd-widget znt-kill-widget | |
alias naliases=n-aliases ncd=n-cd nenv=n-env nfunctions=n-functions nhistory=n-history | |
alias nkill=n-kill noptions=n-options npanelize=n-panelize nhelp=n-help | |
zle -N znt-history-widget | |
bindkey '^R' znt-history-widget | |
setopt AUTO_PUSHD HIST_IGNORE_DUPS PUSHD_IGNORE_DUPS | |
zstyle ':completion::complete:n-kill::bits' matcher 'r:|=** l:|=*' | |
# }}} | |
if [[ -x /usr/bin/dircolors ]]; then | |
test -r ${HOME}/.dircolors && eval "$(dircolors -b ${HOME}/.dircolors)" || eval "$(dircolors -b)" | |
alias ls="ls --color=auto" | |
alias grep="grep --color=auto" | |
alias fgrep="fgrep --color=auto" | |
alias egrep="egrep --color=auto" | |
fi | |
# open files in TextWrangler | |
alias trang="java -jar /opt/java/trang.jar" | |
alias jing="java -jar /opt/java/jing.jar" | |
alias dtdinst="java -jar /opt/java/dtdinst.jar" | |
alias tw="open -a /Applications/TextWrangler.app" | |
alias bfg="java -jar $(brew --prefix)/etc/jar/bfg-1.12.8.jar" | |
alias cls="clear" | |
# }}} | |
# Exports {{{ | |
export HELPDIR="$(brew --prefix)/share/zsh/help" | |
# Python {{{ | |
#export PYTHON2_ROOT="/Library/Frameworks/Python.framework/Versions/2.7" | |
#export PYTHONPATH="$(brew --prefix)/lib/python2.7:$(brew --prefix)/lib/python3.5:/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7:/Library/Frameworks/Python.framework/Versions/3.5" | |
#export PYTHON_ROOT="/Library/Frameworks/Python.framework/Versions/3.5" | |
#export PATH="${PYTHON_ROOT}/bin:${PATH}" | |
# pyenv {{{ | |
export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages' | |
export PYENV_ROOT="${HOME}/.pyenv" | |
export PYENV_VERSION='3.5.1' | |
#export PATH="${PYENV_ROOT}/bin:${PATH}" | |
#if which pyenv > /dev/null; then eval "$(pyenv init -)"; fi | |
# pyenv-virtualenv | |
#if which pyenv-virtualenv-init > /dev/null; then eval "$(pyenv virtualenv-init -)"; fi | |
# }}} | |
# }}} | |
# NOTE: the PATH variable loads /etc/paths & files in /etc/paths.d/ by default. | |
# Editor | |
export EDITOR='mvim' | |
export VISUAL='subl -n' | |
export ARCHFLAGS="-arch x86_64" | |
# rbenv {{{ | |
# Add rbenv to path | |
export RBENV_ROOT="$(brew --prefix)/var/rbenv" | |
export RBENV_VERSION="2.3.0" | |
export PATH="$RBENV_ROOT/bin:$RBENV_ROOT/shims:${PATH}" | |
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi | |
# }}} | |
#/usr/libexec/path_helper -s | |
# XML Catalog | |
if [[ -f $(brew --prefix)/etc/xml/catalog ]]; then export XML_CATALOG_FILES="$(brew --prefix)/etc/xml/catalog"; fi | |
# ccache | |
if [[ -d /usr/local/opt/ccache/libexec ]]; then | |
export PATH="$PATH:/usr/local/opt/ccache/libexec" | |
fi | |
# thefuck | |
export TF_ALIAS="fuck" | |
export HOMEBREW_CASK_OPTS="--appdir=/Applications" | |
export LLVM_CONFIG="/usr/local/opt/llvm/bin/llvm-config" | |
export NODE_PATH="/usr/local/lib/node_modules" | |
export PATH="${HOME}/.node/bin:${PATH}" | |
export MANPATH="${MANPATH}:/usr/share/man:/usr/local/share/man:/Library/Developer/CommandLineTools/usr/share/man:/opt/X11/share/man:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/share/man:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man:/Applications/Xcode.app/Contents/Developer/usr/share/man" | |
export MAGICK_HOME="$(brew --prefix)" | |
export MONO_GAC_PREFIX="$(brew --prefix)" | |
export MONO_MANAGED_WATCHER="disabled" | |
export JAVAROOT="/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home" | |
export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home" | |
export ECLIPSELINK_HOME="/opt/eclipselink" | |
export GPGROOT="/usr/local/MacGPG2/bin" | |
export GITROOT="$(brew --prefix)/git/bin:$(brew --prefix)/git/libexec/git-core" | |
export GOROOT="$(brew --prefix)/opt/go/libexec/bin" | |
export GOPATH="${HOME}/Documents/Projects/go" | |
export PERLBREW_HOME="${HOME}/.perl5/perlbrew" | |
export PERLBREW_PATH="${HOME}/.perl5/perlbrew/bin" | |
export PERLBREW_PERL="perl-5.22.0" | |
export PERLBREW_ROOT="${HOME}/.perl5/perlbrew" | |
export PERLBREW_VERSION="0.73" | |
export PATH="${PATH}:/Library/Developer/CommandLineTools/usr/bin:/opt/X11/bin:${GITROOT}:${GPGROOT}:${GEM_HOME}/bin:${JAVAROOT}/bin:${GOROOT}:${PERLBREW_ROOT}/bin" | |
export PATH="/Applications/VLC.app/Contents/MacOS:${PATH}" | |
# }}} | |
# Source Lines {{{ | |
# perlbrew; the bashrc *does* work for zsh. | |
[[ -f ${HOME}/.perl5/etc/bashrc ]] && . ${HOME}/.perl5/etc/bashrc | |
# z jumplist | |
[[ -f ${HOME}/.z.sh ]] && . ${HOME}/.z.sh | |
#[[ -f $(brew --prefix)/etc/profile.d/z.sh ]] && . $(brew --prefix)/etc/profile.d/z.sh | |
# fzf - jumplist | |
#[[ -f ${HOME}/.fzf.zsh ]] && . ${HOME}/.fzf.zsh | |
# travis | |
#[[ -f ${HOME}/.travis/travis.sh ]] && . ${HOME}/.travis/travis.sh | |
# direnv | |
#_direnv_hook() { | |
# eval "$(direnv export zsh)"; | |
#} | |
#typeset -ag precmd_functions | |
#[[ -z $precmd_functions[(r)_direnv_hook] ]] && precmd_functions+=_direnv_hook; | |
# user completions | |
fpath=(${HOME}/.zsh/completions $fpath) | |
# homebrew zsh-completions | |
fpath=($(brew --prefix)/share/zsh-completions $fpath) | |
# git-completion | |
if [[ -f ${HOME}/.git-completion.zsh ]]; then | |
zstyle ':completion:*:*:git:*' script ${HOME}/.git-completion.zsh | |
fi | |
# nvm | |
if [[ -f $(brew --prefix nvm)/nvm.sh ]]; then | |
export NVM_DIR="${HOME}/.nvm" | |
. $(brew --prefix nvm)/nvm.sh | |
fi | |
# grc | |
[[ -f $(brew --prefix)/etc/grc.bashrc ]] && . $(brew --prefix)/etc/grc.bashrc | |
# grunt-cli completion | |
eval "$(grunt --completion=zsh)" | |
# npm-completion {{{ | |
if type complete &>/dev/null; then | |
_npm_completion () { | |
local words cword | |
if type _get_comp_words_by_ref &>/dev/null; then | |
_get_comp_words_by_ref -n = -n @ -w words -i cword | |
else | |
cword="$COMP_CWORD" | |
words=("${COMP_WORDS[@]}") | |
fi | |
local si="$IFS" | |
IFS=$'\n' COMPREPLY=($(COMP_CWORD="$cword" \ | |
COMP_LINE="$COMP_LINE" \ | |
COMP_POINT="$COMP_POINT" \ | |
npm completion -- "${words[@]}" \ | |
2>/dev/null)) || return $? | |
IFS="$si" | |
} | |
complete -o default -F _npm_completion npm | |
elif type compdef &>/dev/null; then | |
_npm_completion() { | |
local si=$IFS | |
compadd -- $(COMP_CWORD=$((CURRENT-1)) \ | |
COMP_LINE=$BUFFER \ | |
COMP_POINT=0 \ | |
npm completion -- "${words[@]}" \ | |
2>/dev/null) | |
IFS=$si | |
} | |
compdef _npm_completion npm | |
elif type compctl &>/dev/null; then | |
_npm_completion () { | |
local cword line point words si | |
read -Ac words | |
read -cn cword | |
let cword-=1 | |
read -l line | |
read -ln point | |
si="$IFS" | |
IFS=$'\n' reply=($(COMP_CWORD="$cword" \ | |
COMP_LINE="$line" \ | |
COMP_POINT="$point" \ | |
npm completion -- "${words[@]}" \ | |
2>/dev/null)) || return $? | |
IFS="$si" | |
} | |
compctl -K _npm_completion npm | |
fi | |
# }}} | |
# asp.net: dvnm | |
#[[ -s "${HOME}/.dnx/dnvm/dnvm.sh" ]] && . "${HOME}/.dnx/dnvm/dnvm.sh" | |
# }}} | |
# }}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment