From a4d559f68909cfc2dd1c175a6fe68f0dad67b80d Mon Sep 17 00:00:00 2001 From: Haak Saxberg Date: Mon, 7 Sep 2015 00:51:36 -0700 Subject: [PATCH] updating the zsh and macos options. macos not ready for primetime --- mac-files/setup_mac.sh | 20 +++++++++ zsh-files/exports.zsh | 9 ++++ zsh-files/zsh_opts.zsh | 20 +++++++++ zsh-files/zshrc | 98 ++++++++---------------------------------- 4 files changed, 68 insertions(+), 79 deletions(-) create mode 100644 mac-files/setup_mac.sh create mode 100644 zsh-files/exports.zsh create mode 100644 zsh-files/zsh_opts.zsh diff --git a/mac-files/setup_mac.sh b/mac-files/setup_mac.sh new file mode 100644 index 0000000..621c1cf --- /dev/null +++ b/mac-files/setup_mac.sh @@ -0,0 +1,20 @@ +install_homebrew() { + ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" +} + +grab_dependencies() { + brew install git + brew install vim + brew install zsh + brew install caskroom/cask/brew-cask +} + +main() { + # abort if homebrew is already installed; we don't want to accidentaly stomp on things + if hash brew 2>/dev/null; then + exit(0) + install_homebrew + grab_dependencies +} + +main diff --git a/zsh-files/exports.zsh b/zsh-files/exports.zsh new file mode 100644 index 0000000..3f7fb7d --- /dev/null +++ b/zsh-files/exports.zsh @@ -0,0 +1,9 @@ +# Colors in grep +export GREP_OPTIONS='--color=auto' +export GREP_COLOR='3;33' + +# venv +export VENVS_DIR=$HOME/.virtualenvs + +# Vim is Life, Vim is Happiness +export EDITOR=vim diff --git a/zsh-files/zsh_opts.zsh b/zsh-files/zsh_opts.zsh new file mode 100644 index 0000000..dcb7cdf --- /dev/null +++ b/zsh-files/zsh_opts.zsh @@ -0,0 +1,20 @@ +setopt no_beep # don't beep on error +setopt interactive_comments # Allow comments even in interactive shells +bindkey -v # Vim is king, Vim is life + +# ===== Navigation +setopt pushd_ignore_dups + +# ===== Completion +setopt always_to_end # When completing from the middle of a word, move the cursor to the end of the word +setopt auto_menu # show completion menu on successive tab press. needs unsetop menu_complete to work +setopt auto_name_dirs # any parameter that is set to the absolute name of a directory immediately becomes a name for that directory +setopt complete_in_word # Allow completion from within a word/phrase + +unsetopt menu_complete # do not autoselect the first completion entry + +# ===== Prompt +setopt prompt_subst + +autoload predict-on +predict-on diff --git a/zsh-files/zshrc b/zsh-files/zshrc index 8486f8d..81109ab 100644 --- a/zsh-files/zshrc +++ b/zsh-files/zshrc @@ -1,59 +1,32 @@ -# Path to your oh-my-zsh configuration. -ZSH=$HOME/.oh-my-zsh +HISTFILE=~/.histfile +HISTSIZE=1000 +SAVEHIST=1000 -# 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="juanghurtado" +source ~/antigen.zsh -# Example aliases -# alias zshconfig="mate ~/.zshrc" -# alias ohmyzsh="mate ~/.oh-my-zsh" +antigen use oh-my-zsh -# Set to this to use case-sensitive completion -# CASE_SENSITIVE="true" +antigen bundle zsh-users/zsh-syntax-highlighting +antigen bundle zsh-users/zsh-history-substring-search +antigen bundle rupa/z +antigen bundle git -# Comment this out to disable bi-weekly auto-update checks -# DISABLE_AUTO_UPDATE="true" +# OSX specific +antigen bundle brew +antigen bundle brew-cask -# Uncomment to change how often before auto-updates occur? (in days) -# export UPDATE_ZSH_DAYS=13 +antigen theme bureau -# Uncomment following line if you want to disable colors in ls -# DISABLE_LS_COLORS="true" +antigen apply -# Uncomment following line if you want to disable autosetting terminal title. -# DISABLE_AUTO_TITLE="true" +source ~/dotfiles/zsh-files/zsh_opts.zsh +source ~/dotfiles/zsh-files/exports.zsh -# Uncomment following line if you want to disable command autocorrection -# DISABLE_CORRECTION="true" -# Uncomment following line if you want red dots to be displayed while waiting for completion -# COMPLETION_WAITING_DOTS="true" +zstyle :compinstall filename '/Users/haak/.zshrc' -# Uncomment 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" - -# 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) -plugins=(git) - -source $ZSH/oh-my-zsh.sh - -# Customize to your needs... - -# Powerline! -#. ~/dotfiles/misc-files/powerline/powerline/bindings/zsh/powerline.zsh -# export PYTHONPATH=~/.vim/bundle/powerline:$PYTHONPATH -# - -alias vim="~/local/bin/vim" -export PATH=~/local/bin:~/dotfiles/bin:$PATH -export EDITOR=vim +autoload -Uz compinit +compinit function branch_prompt { BRANCH=$(current_branch) @@ -75,36 +48,3 @@ fancy-ctrl-z () { } zle -N fancy-ctrl-z bindkey '^Z' fancy-ctrl-z - -function in_sandbox { - if [ ! -z "${YELP_IN_SANDBOX}" ]; then - echo " (sandbox)" - fi - if [ ! -z "${SELENIUM_PORT}" ]; then - echo " (selenium)" - fi -} - -ZSH_THEME_GIT_PROMPT_AHEAD=" %{$YELLOW%}⇈%{$RESET_COLOR%}" -ZSH_THEME_GIT_PROMPT_BEHIND=" %{$YELLOW%}⇊%{$RESET_COLOR%}" -ZSH_THEME_GIT_PROMPT_DIVERGED=" %{$YELLOW%}⇅%{$RESET_COLOR%}" - -ZSH_THEME_GIT_PROMPT_UNTRACKED=" %{$YELLOW%}[U]%{$RESET_COLOR%}" -ZSH_THEME_GIT_PROMPT_MODIFIED=" %{$RED%}☢%{$RESET_COLOR%}" -ZSH_THEME_GIT_PROMPT_UNMERGED=" %{$RED%}⑂%{$RESET_COLOR%}" -ZSH_THEME_GIT_PROMPT_DELETED=" %{$RED%}[D]%{$RESET_COLOR%}" -ZSH_THEME_GIT_PROMPT_RENAMED=" %{$YELLOW%}[R]%{$RESET_COLOR%}" -ZSH_THEME_GIT_PROMPT_ADDED=" %{$GREEN%}⇶%{$RESET_COLOR%}" -ZSH_THEME_GIT_PROMPT_DIRTY=" %{$RED%}☢%{$RESET_COLOR%}" - -function in_venv { - VIRTUALENV_DISPLAY_STRING=${VIRTUAL_ENV##*/} - if [ ! -z "$VIRTUALENV_DISPLAY_STRING" ]; then - echo "($VIRTUALENV_DISPLAY_STRING) " - fi -} - -PROMPT=' -%{$fg_bold[green]%}[%n@%m]%{$fg[white]%} $(in_venv)%{$fg[yellow]%}[%~]%{$reset_color%} -$(in_sandbox)%{$fg[blue]%}>%{$reset_color%} ' -RPROMPT='$(git_prompt_ahead)$(parse_git_dirty) $(branch_prompt)%{$reset_color%} %{$reset_color%}'