Skip to content

Instantly share code, notes, and snippets.

@jkachmar
Created July 29, 2016 19:08
Show Gist options
  • Save jkachmar/d2a5f9819336893ad4d2b8570e560216 to your computer and use it in GitHub Desktop.
Save jkachmar/d2a5f9819336893ad4d2b8570e560216 to your computer and use it in GitHub Desktop.
ZSH Dotfiles
# Setup NVM
export NVM_DIR=~/.nvm
source /usr/local/opt/nvm/nvm.sh
PATH=/usr/local/bin:/usr/local/sbin:/usr/local/opt/gnu-sed/libexec/gnubin:$PATH
PATH=$PATH:$HOME/.cargo/bin
PATH=$PATH:/opt/esp-open-sdk/utils:
PATH=$PATH:$HOME/.stack/programs/x86_64-osx/ghc-7.10.3/bin:$HOME/.local/bin
PATH=$PATH:$GOPATH/bin:
PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin
PATH=$PATH:/usr/local/gcc_arm/gcc-arm-none-eabi-5_4-2016q2/bin
export PATH
ZPLUG_HOME=$HOME/config/zplug
source `brew --prefix zplug`/init.zsh
# Plugins
zplug "plugins/brew", from:oh-my-zsh, if:"[[ $OSTYPE == *darwin* ]]", nice:10
zplug "plugins/brew-cask", from:oh-my-zsh, if:"[[ $OSTYPE == *darwin* ]]", nice:10
zplug "plugins/git", from:oh-my-zsh, if:"(( $+commands[git] ))", nice:10
zplug "plugins/npm", from:oh-my-zsh
zplug "plugins/osx", from:oh-my-zsh, if:"[[ $OSTYPE == *darwin* ]]", nice:10
zplug "zsh-users/zsh-autosuggestions", nice:10
zplug "zsh-users/zsh-completions"
zplug "zsh-users/zsh-history-substring-search", nice:19 # load last
zplug "zsh-users/zsh-syntax-highlighting", nice:18 # load second to last
# Theme
setopt prompt_subst
zplug "themes/sorin", from:oh-my-zsh
# Install plugins if there are plugins that have not been installed
if ! zplug check --verbose; then
printf "Install? [y/N]: "
if read -q; then
echo; zplug install
fi
fi
# Load plugins
zplug load
# ZSH history
setopt append_history
setopt hist_expire_dups_first
setopt hist_fcntl_lock
setopt hist_ignore_all_dups
setopt hist_lex_words
setopt hist_reduce_blanks
setopt hist_save_no_dups
setopt share_history
# ### AUTOSUGGESTIONS ###
if zplug check zsh-users/zsh-autosuggestions; then
# Add history-substring-search-* widgets to list of widgets that clear the autosuggestion
ZSH_AUTOSUGGEST_CLEAR_WIDGETS+=(history-substring-search-uphistory-substring-search-down)
# Remove *-line-or-history widgets from list of widgets that clear the autosuggestion
# to avoid conflict with history-substring-search-* widgets
ZSH_AUTOSUGGEST_CLEAR_WIDGETS=("${(@)ZSH_AUTOSUGGEST_CLEAR_WIDGETS:#(up|down)-line-or-history}")
fi
# Bind UP and DOWN arrow keys for subsstring search.
if zplug check zsh-users/zsh-history-substring-search; then
zmodload zsh/terminfo
bindkey "$terminfo[kcuu1]" history-substring-search-up
bindkey "$terminfo[kcud1]" history-substring-search-down
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment