aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Singleton <matthew.j.singleton@gmail.com>2011-02-18 17:05:47 -0500
committerMatt Singleton <matthew.j.singleton@gmail.com>2011-02-18 17:05:47 -0500
commitbb3b34829a0599a2c356a46fdfa75c3f9c525088 (patch)
tree69cfc5baf380c5b4151df69fb8ba6d7525c4c0e3
parentfa40c9c0a1ec3238053575a2fac228f92d49fd78 (diff)
removing dependency on oh-my-zsh
-rwxr-xr-xdeploy.sh16
-rwxr-xr-xdiff.sh4
-rw-r--r--oh-my-zsh/xcolour.zsh-theme65
-rw-r--r--vimrc1
-rw-r--r--zsh/appearance.zsh41
-rw-r--r--zsh/completion.zsh58
-rw-r--r--zsh/correction.zsh9
-rw-r--r--zsh/functions.zsh-overrides10
-rw-r--r--zsh/git.zsh19
-rw-r--r--zsh/history.zsh18
-rw-r--r--zsh/key-bindings.zsh22
-rw-r--r--zsh/svn.zsh (renamed from oh-my-zsh/svn.zsh)3
-rw-r--r--zsh/termsupport.zsh23
-rw-r--r--zshrc39
14 files changed, 208 insertions, 120 deletions
diff --git a/deploy.sh b/deploy.sh
index 1f220ca..cdcf81e 100755
--- a/deploy.sh
+++ b/deploy.sh
@@ -2,18 +2,6 @@
set -e
-# check for dependencies
-echo "Checking for dependencies"
-echo " oh-my-zsh..."
-if [ ! -e ~/.oh-my-zsh/lib ]; then
- echo " not found!"
- exit 1
-fi
-if [ ! -e ~/.oh-my-zsh/themes ]; then
- echo " not found!"
- exit 1
-fi
-
# template git profile
echo "enter your global git user name:"
read name
@@ -28,8 +16,8 @@ do
cp $f ~/.${f}
done
-cp oh-my-zsh/svn.zsh ~/.oh-my-zsh/lib/svn.zsh
-cp oh-my-zsh/xcolour.zsh-theme ~/.oh-my-zsh/themes/xcolour.zsh-theme
+mkdir -p ~/.zsh
+cp oh-my-zsh/* ~/.zsh
mkdir -p ~/.vim
cp -r vim/* ~/.vim
diff --git a/diff.sh b/diff.sh
index ae7d660..b5e8984 100755
--- a/diff.sh
+++ b/diff.sh
@@ -10,9 +10,7 @@ diff -U 0 mostrc ~/.mostrc
echo
diff -U 0 zshrc ~/.zshrc
echo
-diff -U 0 oh-my-zsh/svn.zsh ~/.oh-my-zsh/lib/svn.zsh
-echo
-diff -U 0 oh-my-zsh/xcolour.zsh-theme ~/.oh-my-zsh/themes/xcolour.zsh-theme
+diff -U 0 zsh ~/.zsh
echo
diff -r -U 0 vim ~/.vim
diff --git a/oh-my-zsh/xcolour.zsh-theme b/oh-my-zsh/xcolour.zsh-theme
deleted file mode 100644
index 1578a47..0000000
--- a/oh-my-zsh/xcolour.zsh-theme
+++ /dev/null
@@ -1,65 +0,0 @@
-# Matt Singleton's oh-my-zsh theme
-
-function prompt_char {
- git branch >/dev/null 2>/dev/null && echo '±' && return
- svn info >/dev/null 2>/dev/null && echo 'ϟ' && return
- echo '$'
-}
-
-function return_code {
- code=$(echo $?)
- if [[ $code == "0" ]]; then
- return
- else
- echo "%{$fg[red]%}$code%{$reset_color%} "
- fi
-}
-
-function parse_git_branch {
- echo "${ref#refs/heads/}"
-}
-
-function parse_git_staged {
- $(git diff-index --quiet --cached HEAD) && return
- echo "staged"
-}
-function parse_git_unstaged {
- $(git diff-files --quiet) && return
- echo "unstaged"
-}
-
-function my_git_prompt_info {
- ref=$(git symbolic-ref HEAD 2> /dev/null) || return
-# # staged
-# git diff-index --quiet --cached HEAD
-# if [ $? -eq 1 ]; then
-# echo "(%{$fg[yellow]%}${ref#refs/heads/}%{$reset_color%}) "
-# return
-# fi
-# # uunstaged
-# git ls-files --exclude-standard --others
-# if [ $? -eq 1 ]; then
-# echo "(%{$fg[red]%}${ref#refs/heads/}%{$reset_color%}) "
-# return
-# fi
-# # untracked and unignored
-# git diff-files --quiet
-# if [ $? -eq 1 ]; then
-# echo "(%{$fg[red]%}${ref#refs/heads/}%{$reset_color%}) "
-# return
-# fi
- echo "(${ref#refs/heads/}) "
-}
-
-PROMPT='%{$fg[yellow]%}%n%{$reset_color%}@%{$fg[green]%}%m%{$reset_color%}:%{$fg[blue]%}%~%{$reset_color%}
-$(return_code)$(my_git_prompt_info)$(prompt_char) %{$reset_color%}'
-
-ZSH_THEME_GIT_PROMPT_PREFIX="("
-ZSH_THEME_GIT_PROMPT_SUFFIX=") "
-ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}✘%{$reset_color%}"
-ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}✔%{$reset_color%}"
-
-ZSH_THEME_SVN_PROMPT_PREFIX="("
-ZSH_THEME_SVN_PROMPT_SUFFIX=") "
-ZSH_THEME_SVN_PROMPT_DIRTY="%{$fg[red]%}✘%{$reset_color%}"
-ZSH_THEME_SVN_PROMPT_CLEAN="%{$fg[green]%}✔%{$reset_color%}"
diff --git a/vimrc b/vimrc
index d47111e..d68dddf 100644
--- a/vimrc
+++ b/vimrc
@@ -57,6 +57,7 @@ if has("autocmd")
" zsh configs and scripts
au BufRead,BufNewFile *.zsh-theme setlocal filetype=zsh
+ au BufRead,BufNewFile *.zsh-overrides setlocal filetype=zsh
au BufRead,BufNewFile *.zsh setlocal filetype=zsh
" ruby files
diff --git a/zsh/appearance.zsh b/zsh/appearance.zsh
new file mode 100644
index 0000000..e8d6dff
--- /dev/null
+++ b/zsh/appearance.zsh
@@ -0,0 +1,41 @@
+#done
+
+autoload colors; colors;
+setopt prompt_subst # expansion of color codes, etc.
+
+# Find the option for using colors in ls, depending on the version: Linux or BSD
+ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G'
+export LSCOLORS="exgxbxdxcxegedxbxgxcxd"
+
+export GREP_OPTIONS='--color=auto'
+export GREP_COLOR='1;32'
+
+export LESS_TERMCAP_mb=$'\e[0;31m' # begin blinking - red
+export LESS_TERMCAP_md=$'\e[0;34m' # begin bold - blue
+export LESS_TERMCAP_me=$'\e[0m' # end mode
+export LESS_TERMCAP_so=$'\e[38;5;246m' # begin standout mode - info box
+export LESS_TERMCAP_se=$'\e[0m' # end standout mode
+export LESS_TERMCAP_us=$'\e[4;33m' # begin underline - yellow underline
+export LESS_TERMCAP_ue=$'\e[0m' # end underline
+
+function theme_preexec () {
+ echo "($fg[magenta]`date +%r`$reset_color) $fg[cyan]$3$reset_color"
+}
+
+function prompt_char {
+ git branch >/dev/null 2>/dev/null && echo '±' && return
+ svn info >/dev/null 2>/dev/null && echo 'ϟ' && return
+ echo '$'
+}
+
+function return_code {
+ code=$(echo $?)
+ if [[ $code == "0" ]]; then
+ return
+ else
+ echo "%{$fg[red]%}$code%{$reset_color%} "
+ fi
+}
+
+PROMPT='%{$fg[yellow]%}%n%{$reset_color%}@%{$fg[green]%}%m%{$reset_color%}:%{$fg[blue]%}%~%{$reset_color%}
+$(return_code)$(git_prompt_info)$(prompt_char) %{$reset_color%}'
diff --git a/zsh/completion.zsh b/zsh/completion.zsh
new file mode 100644
index 0000000..4a6322c
--- /dev/null
+++ b/zsh/completion.zsh
@@ -0,0 +1,58 @@
+# TODO: figure this thing out
+
+unsetopt menu_complete # do not autoselect the first completion entry
+unsetopt flowcontrol
+setopt auto_menu # show completion menu on succesive tab press
+setopt complete_in_word
+setopt always_to_end
+
+WORDCHARS=''
+
+autoload -U compinit
+compinit -i
+
+zmodload -i zsh/complist
+
+zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
+
+zstyle ':completion:*' list-colors ''
+
+# should this be in keybindings?
+bindkey -M menuselect '^o' accept-and-infer-next-history
+
+zstyle ':completion:*:*:*:*:*' menu select
+zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
+zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w"
+
+# disable named-directories autocompletion
+zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
+cdpath=(.)
+
+# use /etc/hosts and known_hosts for hostname completion
+[ -r ~/.ssh/known_hosts ] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
+[ -r /etc/hosts ] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} || _etc_hosts=()
+hosts=(
+ "$_ssh_hosts[@]"
+ "$_etc_hosts[@]"
+ `hostname`
+ localhost
+)
+zstyle ':completion:*:hosts' hosts $hosts
+
+# Use caching so that commands like apt and dpkg complete are useable
+zstyle ':completion::complete:*' use-cache 1
+zstyle ':completion::complete:*' cache-path ~/.oh-my-zsh/cache/
+
+# Don't complete uninteresting users
+zstyle ':completion:*:*:*:users' ignored-patterns \
+ adm amanda apache avahi beaglidx bin cacti canna clamav daemon \
+ dbus distcache dovecot fax ftp games gdm gkrellmd gopher \
+ hacluster haldaemon halt hsqldb ident junkbust ldap lp mail \
+ mailman mailnull mldonkey mysql nagios \
+ named netdump news nfsnobody nobody nscd ntp nut nx openvpn \
+ operator pcap postfix postgres privoxy pulse pvm quagga radvd \
+ rpc rpcuser rpm shutdown squid sshd sync uucp vcsa xfs
+
+# ... unless we really want to.
+zstyle '*' single-ignored show
+
diff --git a/zsh/correction.zsh b/zsh/correction.zsh
new file mode 100644
index 0000000..72692a6
--- /dev/null
+++ b/zsh/correction.zsh
@@ -0,0 +1,9 @@
+#done
+
+setopt correct_all
+
+alias man='nocorrect man'
+alias mv='nocorrect mv'
+alias mysql='nocorrect mysql'
+alias psql='nocorrect psql'
+alias mkdir='nocorrect mkdir'
diff --git a/zsh/functions.zsh-overrides b/zsh/functions.zsh-overrides
new file mode 100644
index 0000000..b2db877
--- /dev/null
+++ b/zsh/functions.zsh-overrides
@@ -0,0 +1,10 @@
+#done
+
+preexec () {
+ term_preexec $*
+ theme_preexec $*
+}
+
+precmd () {
+ term_precmd
+}
diff --git a/zsh/git.zsh b/zsh/git.zsh
new file mode 100644
index 0000000..b0ec297
--- /dev/null
+++ b/zsh/git.zsh
@@ -0,0 +1,19 @@
+#done
+
+function parse_git_branch {
+ echo "${ref#refs/heads/}"
+}
+
+function parse_git_staged {
+ $(git diff-index --quiet --cached HEAD) && return
+ echo "staged"
+}
+function parse_git_unstaged {
+ $(git diff-files --quiet) && return
+ echo "unstaged"
+}
+
+function git_prompt_info {
+ ref=$(git symbolic-ref HEAD 2> /dev/null) || return
+ echo "(${ref#refs/heads/}) "
+}
diff --git a/zsh/history.zsh b/zsh/history.zsh
new file mode 100644
index 0000000..0619fbe
--- /dev/null
+++ b/zsh/history.zsh
@@ -0,0 +1,18 @@
+#TODO: optimize these rules. they are redundant
+
+## Command history configuration
+HISTFILE=$HOME/.zsh_history
+HISTSIZE=10000
+SAVEHIST=10000
+
+setopt hist_ignore_dups # ignore duplication command history list
+setopt share_history # share command history data
+
+setopt hist_verify
+setopt inc_append_history
+setopt extended_history
+setopt hist_expire_dups_first
+setopt hist_ignore_space
+
+setopt SHARE_HISTORY
+setopt APPEND_HISTORY
diff --git a/zsh/key-bindings.zsh b/zsh/key-bindings.zsh
new file mode 100644
index 0000000..b63a68b
--- /dev/null
+++ b/zsh/key-bindings.zsh
@@ -0,0 +1,22 @@
+# TODO: figure these out
+
+autoload -U compinit
+compinit -i
+
+bindkey -e
+bindkey '\ew' kill-region
+bindkey -s '\el' "ls\n"
+bindkey -s '\e.' "..\n"
+bindkey '^r' history-incremental-search-backward
+bindkey "^[[5~" up-line-or-history
+bindkey "^[[6~" down-line-or-history
+
+bindkey "^[[H" beginning-of-line
+bindkey "^[[1~" beginning-of-line
+bindkey "^[[F" end-of-line
+bindkey "^[[4~" end-of-line
+bindkey ' ' magic-space # also do history expansion on space
+
+bindkey '^[[Z' reverse-menu-complete
+
+bindkey "\e[3~" delete-char # make sure delete key works
diff --git a/oh-my-zsh/svn.zsh b/zsh/svn.zsh
index 54d23b4..bbcc69f 100644
--- a/oh-my-zsh/svn.zsh
+++ b/zsh/svn.zsh
@@ -1,5 +1,4 @@
-# utility functions for subversion
-# based on oh-my-zsh git lib module
+#done
function svn_dirty {
if [[ -n $(svn status) ]]; then
diff --git a/zsh/termsupport.zsh b/zsh/termsupport.zsh
new file mode 100644
index 0000000..6768222
--- /dev/null
+++ b/zsh/termsupport.zsh
@@ -0,0 +1,23 @@
+#done
+
+case "$TERM" in
+ xterm*|rxvt*)
+ term_preexec () {
+ print -Pn "\e]0;%n@%m:%~ ($1)\a" # xterm
+ }
+ term_precmd () {
+ print -Pn "\e]0;%n@%m:%~\a" # xterm
+ }
+ ;;
+ screen*)
+ term_preexec () {
+ local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]}
+ echo -ne "\ek$CMD\e\\"
+ print -Pn "\e]0;%n@%m:%~($1)\a" # xterm
+ }
+ term_precmd () {
+ echo -ne "\ekzsh\e\\"
+ print -Pn "\e]0;%n@%m:%~\a" # xterm
+ }
+ ;;
+esac
diff --git a/zshrc b/zshrc
index 29c3846..c715183 100644
--- a/zshrc
+++ b/zshrc
@@ -1,47 +1,14 @@
-# Path to your oh-my-zsh configuration.
-export ZSH=$HOME/.oh-my-zsh
-
-# Set to the name theme to load.
-# Look in ~/.oh-my-zsh/themes/
-export ZSH_THEME="xcolour"
-
-# Set to this to use case-sensitive completion
-export CASE_SENSITIVE="true"
-
-# Comment this out to disable weekly auto-update checks
-export DISABLE_AUTO_UPDATE="true"
-
-# Uncomment following line if you want to disable colors in ls
-# export DISABLE_LS_COLORS="true"
-
-# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
-# Example format: plugins=(rails git textmate ruby lighthouse)
-plugins=(git)
-
-source $ZSH/oh-my-zsh.sh
-
-# Customize to your needs...
-
-export LSCOLORS="exgxbxdxcxegedxbxgxcxd"
+for config_file (~/.zsh/*.zsh) source $config_file
export EDITOR=vim
-bindkey "\e[3~" delete-char
-
if [ -e $HOME/.zshrc-local ]; then
source $HOME/.zshrc-local
fi
-# runs after local because 'most' isn't standard,
-# and may be provided by a local path addition
-if [[ -e $(which most) ]]; then
- export PAGER=most
-fi
-
# run after local because local because user bin should
# take absolute priority
export PATH=$HOME/bin:$PATH
-function preexec () {
- echo "($fg[magenta]`date +%r`$reset_color) $fg[cyan]$3$reset_color"
-}
+# override builtin functions (preexec, precmd, etc.)
+source ~/.zsh/functions.zsh-overrides