Commit 7441438a authored by Max Masnick's avatar Max Masnick
Browse files

merge changes from offical repo

parents 9e3776f1 1120f973
...@@ -3,30 +3,43 @@ ...@@ -3,30 +3,43 @@
# pip zsh completion, based on homebrew completion # pip zsh completion, based on homebrew completion
_pip_all() {
# we cache the list of packages (originally from the macports plugin)
if (( ! $+piplist )); then
echo -n " (caching package index...)"
piplist=($(pip search * | cut -d ' ' -f 1 | tr '[A-Z]' '[a-z]'))
fi
}
_pip_installed() { _pip_installed() {
installed_pkgs=(`pip freeze`) installed_pkgs=(`pip freeze | cut -d '=' -f 1`)
} }
local -a _1st_arguments local -a _1st_arguments
_1st_arguments=( _1st_arguments=(
'bundle:Create pybundles (archives containing multiple packages)' 'bundle:create pybundles (archives containing multiple packages)'
'freeze:Output all currently installed packages (exact versions) to stdout' 'freeze:output all currently installed packages (exact versions) to stdout'
'help:Show available commands' 'help:show available commands'
'install:Install packages' 'install:install packages'
'search:Search PyPI' 'search:search PyPI'
'uninstall:Uninstall packages' 'uninstall:uninstall packages'
'unzip:Unzip individual packages' 'unzip:unzip individual packages'
'zip:Zip individual packages' 'zip:zip individual packages'
) )
local expl local expl
local -a pkgs installed_pkgs local -a all_pkgs installed_pkgs
_arguments \ _arguments \
'(--version)--version[Show version number of program and exit]' \ '(--version)--version[show version number of program and exit]' \
'(-v --verbose)'{-v,--verbose}'[Give more output]' \ '(-h --help)'{-h,--help}'[show help]' \
'(-q --quiet)'{-q,--quiet}'[Give less output]' \ '(-E --environment)'{-E,--environment}'[virtualenv environment to run pip in]' \
'(-h --help)'{-h,--help}'[Show help]' \ '(-s --enable-site-packages)'{-s,--enable-site-packages}'[include site-packages in virtualenv]' \
'(-v --verbose)'{-v,--verbose}'[give more output]' \
'(-q --quiet)'{-q,--quiet}'[give less output]' \
'(--log)--log[log file location]' \
'(--proxy)--proxy[proxy in form user:passwd@proxy.server:port]' \
'(--timeout)--timeout[socket timeout (default 15s)]' \
'*:: :->subcmds' && return 0 '*:: :->subcmds' && return 0
if (( CURRENT == 1 )); then if (( CURRENT == 1 )); then
...@@ -35,10 +48,25 @@ if (( CURRENT == 1 )); then ...@@ -35,10 +48,25 @@ if (( CURRENT == 1 )); then
fi fi
case "$words[1]" in case "$words[1]" in
list) search)
if [[ "$state" == forms ]]; then _arguments \
_pip_installed '(--index)--index[base URL of Python Package Index]' ;;
_requested installed_pkgs expl 'installed packages' compadd -a installed_pkgs freeze)
_arguments \
'(-l --local)'{-l,--local}'[report only virtualenv packages]' ;;
install)
_arguments \
'(-U --upgrade)'{-U,--upgrade}'[upgrade all packages to the newest available version]' \
'(-f --find-links)'{-f,--find-links}'[URL for finding packages]' \
'(--no-deps --no-dependencies)'{--no-deps,--no-dependencies}'[iIgnore package dependencies]' \
'(--no-install)--no-install[only download packages]' \
'(--no-download)--no-download[only install downloaded packages]' \
'(--install-option)--install-option[extra arguments to be supplied to the setup.py]' \
'1: :->packages' && return 0
if [[ "$state" == packages ]]; then
_pip_all
_wanted piplist expl 'packages' compadd -a piplist
fi ;; fi ;;
uninstall) uninstall)
_pip_installed _pip_installed
......
# Thanks to Christopher Sexton # Restart a rack app running under pow
# https://gist.github.com/965032 # http://pow.cx/
function kapow { #
touch ~/.pow/$1/tmp/restart.txt # Adds a kapow command that will restart an app
if [ $? -eq 0 ]; then #
echo "$fg[yellow]Pow restarting $1...$reset_color" # $ kapow myapp
fi #
# Supports command completion.
#
# If you are not already using completion you might need to enable it with
#
# autoload -U compinit compinit
#
# Changes:
#
# Defaults to the current application, and will walk up the tree to find
# a config.ru file and restart the corresponding app
#
# Will Detect if a app does not exist in pow and print a (slightly) helpful
# error message
rack_root_detect(){
setopt chaselinks
local orgdir=$(pwd)
local basedir=$(pwd)
while [[ $basedir != '/' ]]; do
test -e "$basedir/config.ru" && break
builtin cd ".." 2>/dev/null
basedir="$(pwd)"
done
builtin cd $orgdir 2>/dev/null
[[ ${basedir} == "/" ]] && return 1
echo `basename $basedir | sed -E "s/.(com|net|org)//"`
} }
kapow(){
local vhost=$1
[ ! -n "$vhost" ] && vhost=$(rack_root_detect)
if [ ! -h ~/.pow/$vhost ]
then
echo "pow: This domain isn’t set up yet. Symlink your application to ${vhost} first."
return 1
fi
[ ! -d ~/.pow/${vhost}/tmp ] && mkdir -p ~/.pow/$vhost/tmp
touch ~/.pow/$vhost/tmp/restart.txt;
[ $? -eq 0 ] && echo "pow: restarting $vhost.dev"
}
compctl -W ~/.pow -/ kapow compctl -W ~/.pow -/ kapow
powit(){
local basedir=$(pwd)
local vhost=$1
[ ! -n "$vhost" ] && vhost=$(rack_root_detect)
if [ ! -h ~/.pow/$vhost ]
then
echo "pow: Symlinking your app with pow. ${vhost}"
[ ! -d ~/.pow/${vhost} ] && ln -s $basedir ~/.pow/$vhost
return 1
fi
}
# View the standard out (puts) from any pow app
alias kaput="tail -f ~/Library/Logs/Pow/apps/*"
...@@ -2,6 +2,7 @@ alias ss='thin --stats "/thin/stats" start' ...@@ -2,6 +2,7 @@ alias ss='thin --stats "/thin/stats" start'
alias sg='ruby script/generate' alias sg='ruby script/generate'
alias sd='ruby script/destroy' alias sd='ruby script/destroy'
alias sp='ruby script/plugin' alias sp='ruby script/plugin'
alias sr='ruby script/runner'
alias ssp='ruby script/spec' alias ssp='ruby script/spec'
alias rdbm='rake db:migrate' alias rdbm='rake db:migrate'
alias sc='ruby script/console' alias sc='ruby script/console'
......
...@@ -14,6 +14,9 @@ alias rdb='_rails_command dbconsole' ...@@ -14,6 +14,9 @@ alias rdb='_rails_command dbconsole'
alias rdbm='rake db:migrate db:test:clone' alias rdbm='rake db:migrate db:test:clone'
alias rg='_rails_command generate' alias rg='_rails_command generate'
alias rp='_rails_command plugin' alias rp='_rails_command plugin'
alias ru='_rails_command runner'
alias rs='_rails_command server' alias rs='_rails_command server'
alias rsd='_rails_command server --debugger' alias rsd='_rails_command server --debugger'
alias devlog='tail -f log/development.log' alias devlog='tail -f log/development.log'
alias rdm='rake db:migrate'
alias rdr='rake db:rollback'
alias rake="noglob rake" # allows square brackts for rake task invocation
alias brake='noglob bundle exec rake' # execute the bundled rake gem
alias srake='noglob sudo rake' # noglob must come before sudo
alias sbrake='noglob sudo bundle exec rake' # altogether now ...
FOUND_RBENV=0
for rbenvdir in "$HOME/.rbenv" "/usr/local/rbenv" "/opt/rbenv" ; do
if [ -d $rbenvdir/bin -a $FOUND_RBENV -eq 0 ] ; then
FOUND_RBENV=1
export RBENV_ROOT=$rbenvdir
export PATH=${rbenvdir}/bin:$PATH
eval "$(rbenv init -)"
alias rubies="rbenv versions"
alias gemsets="rbenv gemset list"
function current_ruby() {
echo "$(rbenv version-name)"
}
function current_gemset() {
echo "$(rbenv gemset active 2&>/dev/null | sed -e ":a" -e '$ s/\n/+/gp;N;b a' | head -n1)"
}
function gems {
local rbenv_path=$(rbenv prefix)
gem list $@ | sed \
-Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \
-Ee "s|$(echo $rbenv_path)|$fg[magenta]\$rbenv_path$reset_color|g" \
-Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
-Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
}
function rbenv_prompt_info() {
if [[ -n $(current_gemset) ]] ; then
echo "$(current_ruby)@$(current_gemset)"
else
echo "$(current_ruby)"
fi
}
fi
done
unset rbenvdir
if [ $FOUND_RBENV -eq 0 ] ; then
alias rubies='ruby -v'
function gemsets() { echo 'not supported' }
function rbenv_prompt_info() { echo "system: $(ruby -v | cut -f-2 -d ' ')" }
fi
...@@ -3,4 +3,4 @@ ...@@ -3,4 +3,4 @@
alias sgem='sudo gem' alias sgem='sudo gem'
# Find ruby file # Find ruby file
alias rfind='find . -name *.rb | xargs grep -n' alias rfind='find . -name "*.rb" | xargs grep -n'
...@@ -37,7 +37,7 @@ function gems { ...@@ -37,7 +37,7 @@ function gems {
local current_gemset=`rvm-prompt g` local current_gemset=`rvm-prompt g`
gem list $@ | sed \ gem list $@ | sed \
-Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \ -Ee "s/\([0-9, \.]+( .+)?\)/$fg[blue]&$reset_color/g" \
-Ee "s|$(echo $rvm_path)|$fg[magenta]\$rvm_path$reset_color|g" \ -Ee "s|$(echo $rvm_path)|$fg[magenta]\$rvm_path$reset_color|g" \
-Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \ -Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
-Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g" -Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
......
# Contributed and SLIGHTLY modded by Matt Parnell/ilikenwf <parwok -at- gmail>
# Created by the blogger at the URL below...I don't know where to find his/her name
# Original found at http://www.shellperson.net/sprunge-pastebin-script/
usage() {
description | fmt -s >&2
}
description() {
cat << HERE
DESCRIPTION
Upload data and fetch URL from the pastebin http://sprunge.us
USAGE
$0 filename.txt
$0 text string
$0 < filename.txt
piped_data | $0
NOTES
--------------------------------------------------------------------------
* INPUT METHODS *
$0 can accept piped data, STDIN redirection [<filename.txt], text strings following the command as arguments, or filenames as arguments. Only one of these methods can be used at a time, so please see the note on precedence. Also, note that using a pipe or STDIN redirection will treat tabs as spaces, or disregard them entirely (if they appear at the beginning of a line). So I suggest using a filename as an argument if tabs are important either to the function or readability of the code.
* PRECEDENCE *
STDIN redirection has precedence, then piped input, then a filename as an argument, and finally text strings as an arguments.
EXAMPLE:
echo piped | "$0" arguments.txt < stdin_redirection.txt
In this example, the contents of file_as_stdin_redirection.txt would be uploaded. Both the piped_text and the file_as_argument.txt are ignored. If there is piped input and arguments, the arguments will be ignored, and the piped input uploaded.
* FILENAMES *
If a filename is misspelled or doesn't have the necessary path description, it will NOT generate an error, but will instead treat it as a text string and upload it.
--------------------------------------------------------------------------
HERE
exit
}
sprunge() {
if [ -t 0 ]; then
echo Running interactively, checking for arguments... >&2
if [ "$*" ]; then
echo Arguments present... >&2
if [ -f "$*" ]; then
echo Uploading the contents of "$*"... >&2
cat "$*"
else
echo Uploading the text: \""$*"\"... >&2
echo "$*"
fi | curl -F 'sprunge=<-' http://sprunge.us
else
echo No arguments found, printing USAGE and exiting. >&2
usage
fi
else
echo Using input from a pipe or STDIN redirection... >&2
while read -r line ; do
echo $line
done | curl -F 'sprunge=<-' http://sprunge.us
fi
}
# Symfony2 basic command completion
_symfony2_get_command_list () {
app/console --no-ansi | sed "1,/Available commands/d" | awk '/^ [a-z]+/ { print $1 }'
}
_symfony2 () {
if [ -f app/console ]; then
compadd `_symfony2_get_command_list`
fi
}
compdef _symfony2 app/console
\ No newline at end of file
#compdef task #compdef task
#
# zsh completion for taskwarrior # zsh completion for taskwarrior
# #
# taskwarrior - a command line task list manager.
#
# Copyright 2010 - 2011 Johannes Schlatow # Copyright 2010 - 2011 Johannes Schlatow
# Copyright 2009 P.C. Shyamshankar # Copyright 2009 P.C. Shyamshankar
# All rights reserved.
#
# This script is part of the taskwarrior project.
# #
# This program is free software; you can redistribute it and/or modify it under # Permission is hereby granted, free of charge, to any person obtaining a copy
# the terms of the GNU General Public License as published by the Free Software # of this software and associated documentation files (the "Software"), to deal
# Foundation; either version 2 of the License, or (at your option) any later # in the Software without restriction, including without limitation the rights
# version. # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# #
# This program is distributed in the hope that it will be useful, but WITHOUT # The above copyright notice and this permission notice shall be included
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # in all copies or substantial portions of the Software.
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
# #
# You should have received a copy of the GNU General Public License along with # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# this program; if not, write to the # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# #
# Free Software Foundation, Inc., # http://www.opensource.org/licenses/mit-license.php
# 51 Franklin Street, Fifth Floor,
# Boston, MA
# 02110-1301
# USA
# #
typeset -g _task_cmds _task_projects _task_tags _task_config _task_modifiers typeset -g _task_cmds _task_projects _task_tags _task_config _task_modifiers
_task_projects=($(task _projects)) _task_projects=($(task _projects))
_task_tags=($(task _tags)) _task_tags=($(task _tags))
_task_ids=($(task _ids)) _task_ids=($(task _ids))
_task_config=($(task _config)) _task_config=($(task _config))
_task_columns=($(task _columns))
_task_modifiers=( _task_modifiers=(
'before' \ 'before' \
'after' \ 'after' \
...@@ -46,39 +46,19 @@ _task_modifiers=( ...@@ -46,39 +46,19 @@ _task_modifiers=(
'word' \ 'word' \
'noword' 'noword'
) )
_task_conjunctions=(
'and' \
'or' \
'xor' \
'\)'
'\('
)
_task_cmds=($(task _commands)) _task_cmds=($(task _commands))
_task_zshcmds=( ${(f)"$(task _zshcommands)"} ) _task_zshcmds=( ${(f)"$(task _zshcommands)"} )
_task_idCmds=(
'append' \
'prepend' \
'annotate' \
'denotate' \
'edit' \
'duplicate' \
'info' \
'start' \
'stop' \
'done'
)
_task_idCmdsDesc=(
'append:Appends more description to an existing task.' \
'prepend:Prepends more description to an existing task.' \
'annotate:Adds an annotation to an existing task.' \
'denotate:Deletes an annotation of an existing task.' \
'edit:Launches an editor to let you modify a task directly.' \
'duplicate:Duplicates the specified task, and allows modifications.' \
'info:Shows all data, metadata for specified task.' \
'start:Marks specified task as started.' \
'stop:Removes the start time from a task.' \
'done:Marks the specified task as completed.'
)
_task() { _task() {
_arguments -s -S \ _arguments -s -S \
"*::task command:_task_commands" "*::task default:_task_default"
return 0 return 0
} }
...@@ -148,6 +128,7 @@ _regex_words values 'task frequencies' \ ...@@ -148,6 +128,7 @@ _regex_words values 'task frequencies' \
'weekly:Every week' \ 'weekly:Every week' \
'biweekly:Every two weeks' \ 'biweekly:Every two weeks' \
'fortnight:Every two weeks' \ 'fortnight:Every two weeks' \
+ 'monthly:Every month' \
'quarterly:Every three months' \ 'quarterly:Every three months' \
'semiannual:Every six months' \ 'semiannual:Every six months' \
'annual:Every year' \ 'annual:Every year' \
...@@ -196,22 +177,13 @@ _regex_arguments _task_attributes "${args[@]}" ...@@ -196,22 +177,13 @@ _regex_arguments _task_attributes "${args[@]}"
## task commands ## task commands
# default completion # filter completion
(( $+functions[_task_default] )) || (( $+functions[_task_filter] )) ||
_task_default() { _task_filter() {
_task_attributes "$@" _task_attributes "$@"
}
# commands expecting an ID # TODO complete conjunctions only if the previous word is a filter expression, i.e. attribute, ID, any non-command
(( $+functions[_task_id] )) || _describe -t default 'task conjunctions' _task_conjunctions
_task_id() {
if (( CURRENT < 3 )); then
# update IDs
_task_zshids=( ${(f)"$(task _zshids)"} )
_describe -t values 'task IDs' _task_zshids
else
_task_attributes "$@"
fi
} }
# merge completion # merge completion
...@@ -235,46 +207,42 @@ _task_pull() { ...@@ -235,46 +207,42 @@ _task_pull() {
_files _files
} }
# execute completion
(( $+functions[_task_execute] )) ||
_task_execute() {
_files
}
# modify (task [0-9]* ...) completion # id-only completion
(( $+functions[_task_modify] )) || (( $+functions[_task_id] )) ||
_task_modify() { _task_id() {
_describe -t commands 'task command' _task_idCmdsDesc _describe -t values 'task IDs' _task_zshids
_task_attributes "$@"
} }
## first level completion => task sub-command completion ## first level completion => task sub-command completion
(( $+functions[_task_commands] )) || (( $+functions[_task_default] )) ||
_task_commands() { _task_default() {
local cmd ret=1 local cmd ret=1
if (( CURRENT == 1 )); then
# update IDs
_task_zshids=( ${(f)"$(task _zshids)"} )
_describe -t commands 'task command' _task_zshcmds
_describe -t values 'task IDs' _task_zshids
# TODO match more than one ID
elif [[ $words[1] =~ ^[0-9]*$ ]] then
_call_function ret _task_modify
return ret
else
# local curcontext="${curcontext}"
# cmd="${_task_cmds[(r)$words[1]:*]%%:*}"
cmd="${_task_cmds[(r)$words[1]]}"
idCmd="${(M)_task_idCmds[@]:#$words[1]}"
if (( $#cmd )); then
# curcontext="${curcontext%:*:*}:task-${cmd}"
if (( $#idCmd )); then integer i=1
_call_function ret _task_id while (( i < $#words ))
else do
_call_function ret _task_${cmd} || cmd="${_task_cmds[(r)$words[$i]]}"
_call_function ret _task_default || if (( $#cmd )); then
_message "No command remaining." _call_function ret _task_${cmd} ||
fi _call_function ret _task_filter ||
else _message "No command remaining."
_message "Unknown subcommand ${cmd}" return ret
fi fi
return ret (( i++ ))
fi done
# update IDs
_task_zshids=( ${(f)"$(task _zshids)"} )
_describe -t commands 'task command' _task_zshcmds
_describe -t values 'task IDs' _task_zshids
_call_function ret _task_filter
return ret
} }
# Set Apple Terminal.app resume directory
# based on this answer: http://superuser.com/a/315029
function chpwd {
local SEARCH=' '
local REPLACE='%20'
local PWD_URL="file://$HOSTNAME${PWD//$SEARCH/$REPLACE}"
printf '\e]7;%s\a' "$PWD_URL"
}
chpwd
\ No newline at end of file
This plugin provides a wrapper around the "wakeonlan" tool available from most
distributions' package repositories, or from the following website:
http://gsd.di.uminho.pt/jpo/software/wakeonlan/
In order to use this wrapper, create the ~/.wakeonlan directory, and place in
that directory one file for each device you would like to be able to wake. Give
the file a name that describes the device, such as its hostname. Each file
should contain a line with the mac address of the target device and the network
broadcast address.
For instance, there might be a file ~/.wakeonlan/leto with the following
contents:
00:11:22:33:44:55:66 192.168.0.255
To wake that device, use the following command:
# wake leto
The available device names will be autocompleted, so:
# wake <tab>
...will suggest "leto", along with any other configuration files that were
placed in the ~/.wakeonlan directory.
For more information regarding the configuration file format, check the
wakeonlan man page.
#compdef wake
#autoload
_arguments "1:device to wake:_files -W '$HOME/.wakeonlan'" && return 0
function wake() {
local config_file="$HOME/.wakeonlan/$1"
if [[ ! -f "$config_file" ]]; then
echo "ERROR: There is no configuration file at \"$config_file\"."
return 1
fi
if (( ! $+commands[wakeonlan] )); then
echo "ERROR: Can't find \"wakeonlan\". Are you sure it's installed?"
return 1
fi
wakeonlan -f "$config_file"
}
...@@ -7,6 +7,10 @@ ZSH=$HOME/.oh-my-zsh ...@@ -7,6 +7,10 @@ ZSH=$HOME/.oh-my-zsh
# time that oh-my-zsh is loaded. # time that oh-my-zsh is loaded.
ZSH_THEME="robbyrussell" ZSH_THEME="robbyrussell"
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# Set to this to use case-sensitive completion # Set to this to use case-sensitive completion
# CASE_SENSITIVE="true" # CASE_SENSITIVE="true"
...@@ -23,6 +27,7 @@ ZSH_THEME="robbyrussell" ...@@ -23,6 +27,7 @@ ZSH_THEME="robbyrussell"
# COMPLETION_WAITING_DOTS="true" # COMPLETION_WAITING_DOTS="true"
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse) # Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git) plugins=(git)
......
local user='%{$fg[magenta]%}%n@%{$fg[magenta]%}%m%{$reset_color%}' local user='%{$fg[magenta]%}%n@%{$fg[magenta]%}%m%{$reset_color%}'
local pwd='%{$fg[blue]%}%~%{$reset_color%}' local pwd='%{$fg[blue]%}%~%{$reset_color%}'
local rvm='%{$fg[green]%}‹$(rvm-prompt i v g)›%{$reset_color%}' local rvm=''
if which rvm-prompt &> /dev/null; then
rvm='%{$fg[green]%}‹$(rvm-prompt i v g)›%{$reset_color%}'
else
if which rbenv &> /dev/null; then
rvm='%{$fg[green]%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$reset_color%}'
fi
fi
local return_code='%(?..%{$fg[red]%}%? ↵%{$reset_color%})' local return_code='%(?..%{$fg[red]%}%? ↵%{$reset_color%})'
local git_branch='$(git_prompt_status)%{$reset_color%}$(git_prompt_info)%{$reset_color%}' local git_branch='$(git_prompt_status)%{$reset_color%}$(git_prompt_info)%{$reset_color%}'
...@@ -19,4 +26,3 @@ ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" ...@@ -19,4 +26,3 @@ ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭"
PROMPT="${user} ${pwd}$ " PROMPT="${user} ${pwd}$ "
RPROMPT="${return_code} ${git_branch} ${rvm}" RPROMPT="${return_code} ${git_branch} ${rvm}"
...@@ -2,7 +2,7 @@ function toon { ...@@ -2,7 +2,7 @@ function toon {
echo -n "" echo -n ""
} }
get_git_dirty() { get_git_dirty() {
git diff --quiet || echo '*' git diff --quiet || echo '*'
} }
...@@ -18,9 +18,12 @@ zstyle ':vcs_info:*' formats \ ...@@ -18,9 +18,12 @@ zstyle ':vcs_info:*' formats \
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r' zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'
zstyle ':vcs_info:*' enable git cvs svn zstyle ':vcs_info:*' enable git cvs svn
precmd () { theme_precmd () {
vcs_info vcs_info
} }
setopt prompt_subst setopt prompt_subst
PROMPT='%{$fg[magenta]%}$(toon)%{$reset_color%} %~/ %{$reset_color%}${vcs_info_msg_0_}%{$reset_color%}' PROMPT='%{$fg[magenta]%}$(toon)%{$reset_color%} %~/ %{$reset_color%}${vcs_info_msg_0_}%{$reset_color%}'
autoload -U add-zsh-hook
add-zsh-hook precmd theme_precmd
\ No newline at end of file
...@@ -3,7 +3,14 @@ local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" ...@@ -3,7 +3,14 @@ local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}' local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}'
local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}' local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}'
local rvm_ruby='%{$fg[red]%}‹$(rvm-prompt i v g)›%{$reset_color%}' local rvm_ruby=''
if which rvm-prompt &> /dev/null; then
rvm_ruby='%{$fg[red]%}‹$(rvm-prompt i v g)›%{$reset_color%}'
else
if which rbenv &> /dev/null; then
rvm_ruby='%{$fg[red]%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$reset_color%}'
fi
fi
local git_branch='$(git_prompt_info)%{$reset_color%}' local git_branch='$(git_prompt_info)%{$reset_color%}'
PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch} PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch}
......
...@@ -29,7 +29,13 @@ ZSH_THEME_GIT_PROMPT_DIRTY=" $CRUNCH_GIT_DIRTY_COLOR✗" ...@@ -29,7 +29,13 @@ ZSH_THEME_GIT_PROMPT_DIRTY=" $CRUNCH_GIT_DIRTY_COLOR✗"
# Our elements: # Our elements:
CRUNCH_TIME_="$CRUNCH_BRACKET_COLOR{$CRUNCH_TIME_COLOR%T$CRUNCH_BRACKET_COLOR}%{$reset_color%}" CRUNCH_TIME_="$CRUNCH_BRACKET_COLOR{$CRUNCH_TIME_COLOR%T$CRUNCH_BRACKET_COLOR}%{$reset_color%}"
CRUNCH_RVM_="$CRUNCH_BRACKET_COLOR"["$CRUNCH_RVM_COLOR\${\$(~/.rvm/bin/rvm-prompt i v g)#ruby-}$CRUNCH_BRACKET_COLOR"]"%{$reset_color%}" if which rvm-prompt &> /dev/null; then
CRUNCH_RVM_="$CRUNCH_BRACKET_COLOR"["$CRUNCH_RVM_COLOR\${\$(~/.rvm/bin/rvm-prompt i v g)#ruby-}$CRUNCH_BRACKET_COLOR"]"%{$reset_color%}"
else
if which rbenv &> /dev/null; then
CRUNCH_RVM_="$CRUNCH_BRACKET_COLOR"["$CRUNCH_RVM_COLOR\${\$(rbenv version | sed -e 's/ (set.*$//' -e 's/^ruby-//')}$CRUNCH_BRACKET_COLOR"]"%{$reset_color%}"
fi
fi
CRUNCH_DIR_="$CRUNCH_DIR_COLOR%~\$(git_prompt_info) " CRUNCH_DIR_="$CRUNCH_DIR_COLOR%~\$(git_prompt_info) "
CRUNCH_PROMPT="$CRUNCH_BRACKET_COLOR➭ " CRUNCH_PROMPT="$CRUNCH_BRACKET_COLOR➭ "
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment