From 611046e3d73360452134dcdcc99be13852cf42e5 Mon Sep 17 00:00:00 2001 From: yan Date: Thu, 22 Mar 2012 12:53:25 -0700 Subject: [PATCH] Added zsh skwp.theme to installer, so we don't rely on my zsh fork anymore --- README.md | 8 -------- Rakefile | 23 ++++++++++++++++++++--- oh-my-zsh/themes/skwp.zsh-theme | 19 +++++++++++++++++++ zsh/zshrc | 1 - 4 files changed, 39 insertions(+), 12 deletions(-) create mode 100644 oh-my-zsh/themes/skwp.zsh-theme diff --git a/README.md b/README.md index 93d776a..134675e 100644 --- a/README.md +++ b/README.md @@ -106,14 +106,6 @@ sudo mv /usr/bin/ctags /usr/bin/ctags_original curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh ``` -Please note: if you want the skwp theme referenced in these dotfiles, you should -grab the skwp fork of oh-my-zsh, which just has the additional theme. While we are -waiting for @robbyrussell to merge the theme upstream (unknown if it will happen). - - cd ~/.oh-my-zsh - git remote add skwp https://github.com/skwp/oh-my-zsh.git - git pull skwp master - ### [fasd](https://github.com/clvv/fasd) fasd gives you handy shell commands `f`,`a`,`s`,`d`, and `z` to jump to recently used files. diff --git a/Rakefile b/Rakefile index cadaa50..1155fbc 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,14 @@ require 'rake' desc "Hook our dotfiles into system-standard positions." -task :install => :submodules do +task :install => [:submodules] do + puts + puts "======================================================" + puts "Welcome to YADR Installation. I'll ask you a few" + puts "questions about which files to install. Nothing will" + puts "be overwritten without your consent." + puts "======================================================" + puts # this has all the linkables from this directory. linkables = [] linkables += Dir.glob('git/*') if want_to_install?('git') @@ -9,6 +16,7 @@ task :install => :submodules do linkables += Dir.glob('ruby/*') if want_to_install?('ruby (gems)') linkables += Dir.glob('{vim,vimrc}') if want_to_install?('vim') linkables += Dir.glob('zsh/zshrc') if want_to_install?('zsh') + Rake::Task['zsh_themes'].invoke skip_all = false overwrite_all = false @@ -36,13 +44,17 @@ task :install => :submodules do end end FileUtils.rm_rf(target) if overwrite || overwrite_all - `mv "$HOME/.#{file}" "$HOME/.#{file}.backup"` if backup || backup_all + run %{ mv "$HOME/.#{file}" "$HOME/.#{file}.backup"` if backup || backup_all } end - `ln -s "#{source}" "#{target}"` + run %{ ln -s "#{source}" "#{target}" } end success_msg("installed") 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') +end + desc "Init and update submodules." task :submodules do sh('git submodule update --init') @@ -52,6 +64,11 @@ task :default => 'install' private +def run(cmd) + puts + puts "[Installing] #{cmd}" + `#{cmd}` unless ENV['DEBUG'] +end def want_to_install? (section) puts "Would you like to install configuration files for: #{section}? [y]es, [n]o" diff --git a/oh-my-zsh/themes/skwp.zsh-theme b/oh-my-zsh/themes/skwp.zsh-theme new file mode 100644 index 0000000..71fd021 --- /dev/null +++ b/oh-my-zsh/themes/skwp.zsh-theme @@ -0,0 +1,19 @@ +# Simple theme with RVM prompt +function preexec() { + typeset -gi CALCTIME=1 + typeset -gi CMDSTARTTIME=SECONDS +} +function precmd() { + if (( CALCTIME )) ; then + typeset -gi ETIME=SECONDS-CMDSTARTTIME + fi + typeset -gi CALCTIME=0 +} + +PROMPT='%{$fg[blue]%}%~%{$fg_bold[yellow]%}$(git_prompt_info)%{$reset_color%}%{$fg[blue]%}➤ %{$reset_color%}' +RPROMPT='%{$fg[blue]%}$(rvm-prompt i v p g) [${ETIME}s] %{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX=" " +ZSH_THEME_GIT_PROMPT_SUFFIX=" " +ZSH_THEME_GIT_PROMPT_DIRTY=" ✗" +ZSH_THEME_GIT_PROMPT_CLEAN=" ✔" diff --git a/zsh/zshrc b/zsh/zshrc index 781985e..cefaf34 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -63,4 +63,3 @@ export LESS_TERMCAP_us=$'\E[04;38;5;146m' # begin underline # Initialize fasd (https://github.com/clvv/fasd) eval "$(fasd --init posix-alias zsh-hook)" -