From 765dc37f893b0df22acdea6d04e567e87458ee14 Mon Sep 17 00:00:00 2001 From: Steven Lu Date: Tue, 9 Jul 2013 23:00:49 -0400 Subject: [PATCH] Fully building the fork into a ready to deploy form --- tools/install.sh | 24 +++++++---- zshrc | 101 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+), 7 deletions(-) create mode 100644 zshrc diff --git a/tools/install.sh b/tools/install.sh index a2bd5665a..e4ef8aeef 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -4,8 +4,13 @@ then exit fi +which zsh || { + echo "zsh not found!" + exit +} + echo "\033[0;34mCloning Oh My Zsh...\033[0m" -hash git >/dev/null && /usr/bin/env git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh || { +hash git >/dev/null && /usr/bin/env git clone https://github.com/unphased/oh-my-zsh.git ~/.oh-my-zsh || { echo "git not installed" exit } @@ -17,16 +22,21 @@ then mv ~/.zshrc ~/.zshrc.pre-oh-my-zsh; fi -echo "\033[0;34mUsing the Oh My Zsh template file and adding it to ~/.zshrc\033[0m" -cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc +echo "\033[0;34mUsing my zshrc, linking ~/.zshrc to it\033[0m" +if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then + rm ~/.zshrc +fi +ln -s "$HOME/.oh-my-zsh/zshrc" ~/.zshrc -echo "\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m" -echo "export PATH=\$PATH:$PATH" >> ~/.zshrc +# cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc -echo "\033[0;34mTime to change your default shell to zsh!\033[0m" +# echo "\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m" +# echo "export PATH=\$PATH:$PATH" >> ~/.zshrc + +echo "\033[0;34mChanging default shell to zsh\033[0m" chsh -s `which zsh` -echo "\033[0;32m"' __ __ '"\033[0m" +echo "\033[0;32m"" __ slu's fork __ ""\033[0m" echo "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m" echo "\033[0;32m"' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '"\033[0m" echo "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m" diff --git a/zshrc b/zshrc new file mode 100644 index 000000000..5f11d5c40 --- /dev/null +++ b/zshrc @@ -0,0 +1,101 @@ +# Path to your oh-my-zsh configuration. +ZSH=$HOME/.oh-my-zsh + +# 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="lust" + +# Example aliases +# alias zshconfig="mate ~/.zshrc" +# alias ohmyzsh="mate ~/.oh-my-zsh" + +# Set to this to use case-sensitive completion +# CASE_SENSITIVE="true" + +# Comment this out to disable bi-weekly auto-update checks +# DISABLE_AUTO_UPDATE="true" + +# Uncomment to change how many often would you like to wait before auto-updates occur? (in days) +# export UPDATE_ZSH_DAYS=13 + +# Uncomment following line if you want to disable colors in ls +# DISABLE_LS_COLORS="true" + +# Uncomment following line if you want to disable autosetting terminal title. +# DISABLE_AUTO_TITLE="true" + +# Uncomment following line if you want red dots to be displayed while waiting for completion +COMPLETION_WAITING_DOTS="true" # yes yes yes + +# 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 cp osx history zsh-syntax-highlighting) + +source $ZSH/oh-my-zsh.sh + + +# Thankfully the path that is already present is the one that the system has set according to +# normal practices. This inserts a few more things that I use from the shell. +export PATH=~/bin:~/util:$PATH:/usr/local/share/npm/bin +# export PAGER=vimpager + +# zmodload zsh/complist +# bindkey -M menuselect ' ' accept-and-infer-next-history +# bindkey -M menuselect '^?' undo + +# vim mode. I'm ready for it. +bindkey -v +bindkey "^H" backward-kill-word +bindkey "^?" backward-delete-char +bindkey "^U" backward-kill-line +# must bind all kind of shit for gettind the damn control keys right now... +bindkey "^[[1;5D" backward-word +bindkey "^[[1;5C" forward-word +bindkey "^[[1;3D" vi-backward-word # alt +bindkey "^[[1;3C" vi-forward-word-end # alt +bindkey "^[[1~" beginning-of-line +bindkey "^[[4~" end-of-line +# bindkey "^[[2~" Thsi should run tmux ctrl a ] to paste copy buffer +bindkey "^[[3~" delete-char +bindkey "^[[5~" up-line-or-search +bindkey "^[[6~" down-line-or-search +bindkey -M vicmd "F10" vi-cmd-mode +# bindkey -m vicmd "F10" this should run a widget that runs tmux to switch pane (Note the semantics are reversed; by default the shell should be in insert mode) +bindkey -M viins '^r' history-incremental-search-backward +bindkey -M vicmd '^r' history-incremental-search-backward + +stty -ixon +stty -ixoff +source $ZSH/plugins/history-substring-search/history-substring-search.plugin.zsh + +export HISTSIZE=20000 +export SAVEHIST=200000 + +function zshaddhistory() { + COMMAND_STR=${1%%$'\n'} + [[ ( -z $COMMAND_STR ) || ( $COMMAND_STR == history ) || \ + ( $COMMAND_STR =~ ^l(s\|l\|a)?$ ) || \ + ( $COMMAND_STR =~ ^(d\|gd\|git\ diff\|glp\|gg)$ ) \ + ]] && return 1 + print -sr "${PWD}///; ${COMMAND_STR}" + fc -p +} + +alias l="ls" +alias gs="git s" # short status +alias glp="git log -p --no-ext-diff" +alias gdt="git difftool" +alias gd="git diff --no-ext-diff" +alias gdc="gd --cached" +alias gg="git lg" +alias gcm="git commit -am" +alias mk="make" +alias v="vim" + +alias ds="dirs -v | head -10" +alias d="gd" + +echo "Finished loading my .zshrc"