Support for @sorin-ionescu rewrite of oh-my-zsh

Sorin's OMZ rewrite is a bit nicer, as it's written in more
native style ZSH, doesn't do auto updates, and incorporates
many bugfixes, and is more actively maintained than Robby's branch.

For now, YADR supports both, so if you want to try out the sorin
branch, go to sorin-ionescu/oh-my-zsh, install it, and rerun
the YADR installer so that the skwp theme is installed for you.

If you want to have them side by side for comparison, rename the
old robby one to ~/.oh-my-zsh.robby or similar, so you can toggle
back and forth through renames, or symlinks.
This commit is contained in:
yan 2012-04-23 10:32:10 -07:00
parent bfae8fcd11
commit ca01730f81
8 changed files with 154 additions and 10 deletions

View File

@ -100,11 +100,12 @@ If that doesn't work, move the OSX supplied ctags [like so](http://www.mattpolit
sudo mv /usr/bin/ctags /usr/bin/ctags_original sudo mv /usr/bin/ctags /usr/bin/ctags_original
``` ```
### [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) ### [oh-my-zsh](https://github.com/sorin-ionescu/oh-my-zsh)
```bash Follow instructions here: [oh-my-zsh](https://github.com/sorin-ionescu/oh-my-zsh)
curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh
``` We prefer the @sorin-ionescu rewrite of Oh My Zsh. It will eventually be shipped
as a submodule of YADR, although you can use the original @robbyrussell version as well.
### [fasd](https://github.com/clvv/fasd) ### [fasd](https://github.com/clvv/fasd)

View File

@ -52,8 +52,14 @@ task :install => [:submodules] do
end end
task :zsh_themes do task :zsh_themes do
if File.exist?("#{ENV['HOME']}/.oh-my-zsh/modules/prompt/functions")
puts "Detected oh-my-zsh @sorin-ionescu version."
run %{ ln -nfs #{ENV["PWD"]}/oh-my-zsh/modules/prompt/functions/* $HOME/.oh-my-zsh/modules/prompt/functions/ } if want_to_install?('zsh themes')
elsif File.exist("#{ENV['HOME']}/.oh-my-zsh")
puts "Detected oh-my-zsh @robbyrussell version."
run %{ ln -nfs #{ENV["PWD"]}/oh-my-zsh/themes/* $HOME/.oh-my-zsh/themes/ } if want_to_install?('zsh themes') run %{ ln -nfs #{ENV["PWD"]}/oh-my-zsh/themes/* $HOME/.oh-my-zsh/themes/ } if want_to_install?('zsh themes')
end end
end
desc "Init and update submodules." desc "Init and update submodules."
task :submodules do task :submodules do

7
oh-my-zsh/README Normal file
View File

@ -0,0 +1,7 @@
The themes/ dir contains themes for oh-my-zsh Robby,
while modules contains themes for oh-my-zsh Sorin Ionescu.
The themes dir will eventually be deprecated in favor
of Sorin's OMZ branch.
See more at: https://github.com/sorin-ionescu/oh-my-zsh

View File

@ -0,0 +1,92 @@
#
# A theme based on steeef theme
# * RVM info shown on the right
# * Git branch info on the left
# * Single line prompt
#
# Authors:
# Steve Losh <steve@stevelosh.com>
# Bart Trojanowski <bart@jukie.net>
# Brian Carper <brian@carper.ca>
# steeef <steeef@gmail.com>
# Sorin Ionescu <sorin.ionescu@gmail.com>
# Yan Pritzker <yan@pritzker.ws>
function rvm_info_for_prompt {
ruby_version=$(~/.rvm/bin/rvm-prompt)
if [ -n "$ruby_version" ]; then
echo "[$ruby_version]"
fi
}
function prompt_skwp_precmd {
# Check for untracked files or updated submodules since vcs_info doesn't.
if [[ ! -z $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then
fmt_branch="(${__PROMPT_SKWP_COLORS[1]}%b%f%u%c${__PROMPT_SKWP_COLORS[4]}●%f)"
else
fmt_branch="(${__PROMPT_SKWP_COLORS[1]}%b%f%u%c)"
fi
zstyle ':vcs_info:*:prompt:*' formats "${fmt_branch}"
vcs_info 'prompt'
}
function prompt_skwp_setup {
setopt LOCAL_OPTIONS
unsetopt XTRACE KSH_ARRAYS
prompt_opts=(cr percent subst)
autoload -Uz add-zsh-hook
autoload -Uz vcs_info
add-zsh-hook precmd prompt_skwp_precmd
# Use extended color pallete if available.
if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then
__PROMPT_SKWP_COLORS=(
"%F{81}" # turquoise
"%F{166}" # orange
"%F{135}" # purple
"%F{161}" # hotpink
"%F{118}" # limegreen
)
else
__PROMPT_SKWP_COLORS=(
"%F{cyan}"
"%F{yellow}"
"%F{magenta}"
"%F{red}"
"%F{green}"
)
fi
# Enable VCS systems you use.
zstyle ':vcs_info:*' enable bzr git hg svn
# check-for-changes can be really slow.
# You should disable it if you work with large repositories.
zstyle ':vcs_info:*:prompt:*' check-for-changes true
# Formats:
# %b - branchname
# %u - unstagedstr (see below)
# %c - stagedstr (see below)
# %a - action (e.g. rebase-i)
# %R - repository path
# %S - path in the repository
local fmt_branch="(${__PROMPT_SKWP_COLORS[1]}%b%f%u%c)"
local fmt_action="(${__PROMPT_SKWP_COLORS[5]}%a%f)"
local fmt_unstaged="${__PROMPT_SKWP_COLORS[2]}●%f"
local fmt_staged="${__PROMPT_SKWP_COLORS[5]}●%f"
zstyle ':vcs_info:*:prompt:*' unstagedstr "${fmt_unstaged}"
zstyle ':vcs_info:*:prompt:*' stagedstr "${fmt_staged}"
zstyle ':vcs_info:*:prompt:*' actionformats "${fmt_branch}${fmt_action}"
zstyle ':vcs_info:*:prompt:*' formats "${fmt_branch}"
zstyle ':vcs_info:*:prompt:*' nvcsformats ""
PROMPT="${__PROMPT_SKWP_COLORS[3]}%n%f@${__PROMPT_SKWP_COLORS[2]}%m%f ${__PROMPT_SKWP_COLORS[5]}%~%f "'${vcs_info_msg_0_}'"$ "
RPROMPT="%F{blue}"'$(rvm_info_for_prompt)'""
}
prompt_skwp_setup "$@"

View File

@ -9,6 +9,7 @@ alias yuv='yadr vim-update-plugins'
alias yip='yadr init-plugins' alias yip='yadr init-plugins'
# PS # PS
alias psa="ps aux"
alias psg="ps aux | grep " alias psg="ps aux | grep "
alias psr='ps aux | grep ruby' alias psr='ps aux | grep ruby'
@ -56,7 +57,7 @@ alias guns='git unstage'
alias gunc='git uncommit' alias gunc='git uncommit'
alias gm='git merge' alias gm='git merge'
alias gms='git merge --squash' alias gms='git merge --squash'
alias gam='git amend' alias gam='git amend --reset-author'
alias gr='git rebase' alias gr='git rebase'
alias gra='git rebase --abort' alias gra='git rebase --abort'
alias ggrc='git rebase --continue' alias ggrc='git rebase --continue'
@ -93,7 +94,6 @@ alias l='less'
alias lh='ls -alt | head' # see the last modified files alias lh='ls -alt | head' # see the last modified files
alias screen='TERM=screen screen' alias screen='TERM=screen screen'
alias cl='clear' alias cl='clear'
alias ps='ps aux'
# Zippin # Zippin
alias gz='tar -zcvf' alias gz='tar -zcvf'

View File

@ -31,4 +31,3 @@ bindkey '^?' backward-delete-char # [Delete] - delete backward
bindkey '^[[3~' delete-char # [fn-Delete] - delete forward bindkey '^[[3~' delete-char # [fn-Delete] - delete forward
bindkey '^[3;5~' delete-char bindkey '^[3;5~' delete-char
bindkey '\e[3~' delete-char bindkey '\e[3~' delete-char

View File

@ -0,0 +1,35 @@
# Set the path to Oh My Zsh.
export OMZ="$HOME/.oh-my-zsh"
# Set the key mapping style to 'emacs' or 'vi'.
# zstyle ':omz:module:editor' keymap 'vi'
# Auto convert .... to ../..
zstyle ':omz:module:editor' dot-expansion 'no'
# Set case-sensitivity for completion, history lookup, etc.
zstyle ':omz:*:*' case-sensitive 'no'
# Color output (auto set to 'no' on dumb terminals).
zstyle ':omz:*:*' color 'yes'
# Auto set the tab and window titles.
zstyle ':omz:module:terminal' auto-title 'yes'
# Set the Zsh modules to load (man zshmodules).
# zstyle ':omz:load' zmodule 'attr' 'stat'
# Set the Zsh functions to load (man zshcontrib).
# zstyle ':omz:load' zfunction 'zargs' 'zmv'
# Set the Oh My Zsh modules to load (browse modules).
zstyle ':omz:load' omodule 'environment' 'terminal' 'editor' 'completion' \
'history' 'directory' 'spectrum' 'alias' 'utility' 'prompt' 'history-substring-search'
# Set the prompt theme to load.
# Setting it to 'random' loads a random theme.
# Auto set to 'off' on dumb terminals.
zstyle ':omz:module:prompt' theme 'skwp'
# This will make you shout: OH MY ZSHELL!
source "$OMZ/init.zsh"

View File

@ -26,8 +26,12 @@ if [[ -d $HOME/.oh-my-zsh ]]; then
for config_file ($yadr/custom/zsh/before/*) source $config_file for config_file ($yadr/custom/zsh/before/*) source $config_file
fi fi
# Source oh-my-zsh # Figure out if we have Robby's or Sorin's Oh-my-zsh
source $ZSH/oh-my-zsh.sh if [[ -f $ZSH/oh-my-zsh.sh ]]; then
source $ZSH/oh-my-zsh.sh # OMZ Robby Russell (https://github.com/robbyrussell/oh-my-zsh)
else
source $yadr/zsh/omz-sorin/omz-sorin.zsh # OMZ Sorin Ionescu (https://github.com/sorin-ionescu/oh-my-zsh)
fi
fi fi
# Configuration # Configuration