diff --git a/README.md b/README.md index 9734122..dec4b61 100644 --- a/README.md +++ b/README.md @@ -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 ``` -### [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) +### [oh-my-zsh](https://github.com/sorin-ionescu/oh-my-zsh) -```bash -curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh -``` +Follow instructions here: [oh-my-zsh](https://github.com/sorin-ionescu/oh-my-zsh) + +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) diff --git a/Rakefile b/Rakefile index 1085afc..cbf228e 100644 --- a/Rakefile +++ b/Rakefile @@ -52,7 +52,13 @@ task :install => [:submodules] do end task :zsh_themes do - run %{ ln -nfs #{ENV["PWD"]}/oh-my-zsh/themes/* $HOME/.oh-my-zsh/themes/ } if want_to_install?('zsh themes') + 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') + end end desc "Init and update submodules." diff --git a/oh-my-zsh/README b/oh-my-zsh/README new file mode 100644 index 0000000..19c247f --- /dev/null +++ b/oh-my-zsh/README @@ -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 diff --git a/oh-my-zsh/modules/prompt/functions/prompt_skwp_setup b/oh-my-zsh/modules/prompt/functions/prompt_skwp_setup new file mode 100644 index 0000000..7740085 --- /dev/null +++ b/oh-my-zsh/modules/prompt/functions/prompt_skwp_setup @@ -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 +# Bart Trojanowski +# Brian Carper +# steeef +# Sorin Ionescu +# Yan Pritzker + +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 "$@" diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 798d930..afea969 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -9,6 +9,7 @@ alias yuv='yadr vim-update-plugins' alias yip='yadr init-plugins' # PS +alias psa="ps aux" alias psg="ps aux | grep " alias psr='ps aux | grep ruby' @@ -56,7 +57,7 @@ alias guns='git unstage' alias gunc='git uncommit' alias gm='git merge' alias gms='git merge --squash' -alias gam='git amend' +alias gam='git amend --reset-author' alias gr='git rebase' alias gra='git rebase --abort' alias ggrc='git rebase --continue' @@ -93,7 +94,6 @@ alias l='less' alias lh='ls -alt | head' # see the last modified files alias screen='TERM=screen screen' alias cl='clear' -alias ps='ps aux' # Zippin alias gz='tar -zcvf' diff --git a/zsh/key-bindings.zsh b/zsh/key-bindings.zsh index a6b7332..0caab73 100644 --- a/zsh/key-bindings.zsh +++ b/zsh/key-bindings.zsh @@ -31,4 +31,3 @@ bindkey '^?' backward-delete-char # [Delete] - delete backward bindkey '^[[3~' delete-char # [fn-Delete] - delete forward bindkey '^[3;5~' delete-char bindkey '\e[3~' delete-char - diff --git a/zsh/omz-sorin/omz-sorin.zsh b/zsh/omz-sorin/omz-sorin.zsh new file mode 100644 index 0000000..12865d7 --- /dev/null +++ b/zsh/omz-sorin/omz-sorin.zsh @@ -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" diff --git a/zsh/zshrc b/zsh/zshrc index 63f213d..87061ca 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -26,8 +26,12 @@ if [[ -d $HOME/.oh-my-zsh ]]; then for config_file ($yadr/custom/zsh/before/*) source $config_file fi - # Source oh-my-zsh - source $ZSH/oh-my-zsh.sh + # Figure out if we have Robby's or Sorin's Oh-my-zsh + 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 # Configuration