From bb3b34829a0599a2c356a46fdfa75c3f9c525088 Mon Sep 17 00:00:00 2001 From: Matt Singleton Date: Fri, 18 Feb 2011 17:05:47 -0500 Subject: removing dependency on oh-my-zsh --- zsh/appearance.zsh | 41 ++++++++++++++++++++++++++++++++ zsh/completion.zsh | 58 +++++++++++++++++++++++++++++++++++++++++++++ zsh/correction.zsh | 9 +++++++ zsh/functions.zsh-overrides | 10 ++++++++ zsh/git.zsh | 19 +++++++++++++++ zsh/history.zsh | 18 ++++++++++++++ zsh/key-bindings.zsh | 22 +++++++++++++++++ zsh/svn.zsh | 15 ++++++++++++ zsh/termsupport.zsh | 23 ++++++++++++++++++ 9 files changed, 215 insertions(+) create mode 100644 zsh/appearance.zsh create mode 100644 zsh/completion.zsh create mode 100644 zsh/correction.zsh create mode 100644 zsh/functions.zsh-overrides create mode 100644 zsh/git.zsh create mode 100644 zsh/history.zsh create mode 100644 zsh/key-bindings.zsh create mode 100644 zsh/svn.zsh create mode 100644 zsh/termsupport.zsh (limited to 'zsh') 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)~~"$( /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/zsh/svn.zsh b/zsh/svn.zsh new file mode 100644 index 0000000..bbcc69f --- /dev/null +++ b/zsh/svn.zsh @@ -0,0 +1,15 @@ +#done + +function svn_dirty { + if [[ -n $(svn status) ]]; then + echo "$ZSH_THEME_SVN_PROMPT_DIRTY" + else + echo "$ZSH_THEME_SVN_PROMPT_CLEAN" + fi +} + +function svn_prompt_info { + info=$(svn info 2>/dev/null) || return + rev=$(echo "$info" | grep Revision | sed 's/Revision: //') + echo "${ZSH_THEME_GIT_PROMPT_PREFIX}r${rev}$(svn_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}" +} 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 -- cgit v1.2.3