Commit 2b55ee07 authored by Roman Kamyk's avatar Roman Kamyk
Browse files

Merge branch 'master' of http://github.com/robbyrussell/oh-my-zsh

parents f71647fa 762b55bb
function savepath() {
pwd > ~/.current_path~
}
# ------------------------------------------------------------------------------
# FILE: osx.plugin.zsh
# DESCRIPTION: oh-my-zsh plugin file.
# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com)
# VERSION: 1.0.1
# ------------------------------------------------------------------------------
function tab() {
savepath
osascript >/dev/null <<EOF
on do_submenu(app_name, menu_name, menu_item, submenu_item)
-- bring the target application to the front
tell application app_name
activate
end tell
tell application "System Events"
tell process app_name
tell menu bar 1
tell menu bar item menu_name
tell menu menu_name
tell menu item menu_item
tell menu menu_item
click menu item submenu_item
end tell
end tell
end tell
end tell
end tell
local command="cd \\\"$PWD\\\""
(( $# > 0 )) && command="${command}; $*"
the_app=$(
osascript 2>/dev/null <<EOF
tell application "System Events"
name of first item of (every process whose frontmost is true)
end tell
end tell
end do_submenu
EOF
)
do_submenu("Terminal", "Shell", "New Tab", 1)
[[ "$the_app" == 'Terminal' ]] && {
osascript 2>/dev/null <<EOF
tell application "System Events"
tell process "Terminal" to keystroke "t" using command down
tell application "Terminal" to do script "${command}" in front window
end tell
EOF
}
}
function itab() {
savepath
osascript >/dev/null <<EOF
on do_submenu(app_name, menu_name, menu_item)
-- bring the target application to the front
tell application app_name
activate
end tell
tell application "System Events"
tell process app_name
tell menu bar 1
tell menu bar item menu_name
tell menu menu_name
click menu item menu_item
end tell
[[ "$the_app" == 'iTerm' ]] && {
osascript 2>/dev/null <<EOF
tell application "iTerm"
set current_terminal to current terminal
tell current_terminal
launch session "Default Session"
set current_session to current session
tell current_session
write text "${command}"
end tell
end tell
end tell
EOF
}
}
function pfd() {
osascript 2>/dev/null <<EOF
tell application "Finder"
return POSIX path of (target of window 1 as alias)
end tell
end do_submenu
EOF
}
do_submenu("iTerm", "Shell", "New Tab")
function pfs() {
osascript 2>/dev/null <<EOF
set output to ""
tell application "Finder" to set the_selection to selection
set item_count to count the_selection
repeat with item_index from 1 to count the_selection
if item_index is less than item_count then set the_delimiter to "\n"
if item_index is item_count then set the_delimiter to ""
set output to output & ((item item_index of the_selection as alias)'s POSIX path) & the_delimiter
end repeat
EOF
}
function cdf() {
cd "$(pfd)"
}
function pushdf() {
pushd "$(pfd)"
}
function quick-look() {
(( $# > 0 )) && qlmanage -p $* &>/dev/null &
}
function man-preview() {
man -t "$@" | open -f -a Preview
}
function trash() {
local trash_dir="${HOME}/.Trash"
local temp_ifs=$IFS
IFS=$'\n'
for item in "$@"; do
if [[ -e "$item" ]]; then
item_name="$(basename $item)"
if [[ -e "${trash_dir}/${item_name}" ]]; then
mv -f "$item" "${trash_dir}/${item_name} $(date "+%H-%M-%S")"
else
mv -f "$item" "${trash_dir}/"
fi
fi
done
IFS=$temp_ifs
}
......@@ -10,7 +10,6 @@ _phing_does_target_list_need_generating () {
_phing () {
if [ -f build.xml ]; then
if _phing_does_target_list_need_generating; then
echo "\nGenerating .phing_targets..." > /dev/stderr
phing -l |grep -v ":" |grep -v "^$"|grep -v "\-" > .phing_targets
fi
compadd `cat .phing_targets`
......
# Thanks to Christopher Sexton
# https://gist.github.com/965032
function kapow {
touch ~/.pow/$1/tmp/restart.txt
if [ $? -eq 0 ]; then
echo "$fg[yellow]Pow restarting $1...$reset_color"
fi
}
compctl -W ~/.pow -/ kapow
#compdef powder
#autoload
compadd `powder help | grep powder | cut -d " " -f 4`
# Rails 3 aliases, backwards-compatible with Rails 2.
function _bundle_command {
if command -v bundle && [ -e "Gemfile" ]; then
bundle exec $@
else
$@
fi
}
function _rails_command () {
if [ -e "script/server" ]; then
ruby script/$@
......@@ -25,6 +17,3 @@ alias rp='_rails_command plugin'
alias rs='_rails_command server'
alias rsd='_rails_command server --debugger'
alias devlog='tail -f log/development.log'
alias rspec='_bundle_command rspec'
alias cuke='_bundle_command cucumber'
......@@ -51,7 +51,7 @@ _1st_arguments=(
'keys:find all keys matching the given pattern'
'lastsave:get the UNIX timestamp of the last successful save to disk'
'lindex:get an element from a list by its index'
'linset:insert an element before or after another element in a list'
'linsert:insert an element before or after another element in a list'
'llen:get the length of a list'
'lpop:remove and get the first element in a list'
'lpush:prepend a value to a list'
......
# TODO: Make this compatible with rvm.
# Run sudo gem on the system ruby, not the active ruby.
alias sgem='sudo gem'
# Find ruby file
alias rfind='find . -name *.rb | xargs grep -n'
\ No newline at end of file
alias rfind='find . -name *.rb | xargs grep -n'
#compdef rvm
local curcontext="$curcontext" state line cmds ret=1
_arguments -C \
'(- 1 *)'{-v,--version}'[display version information]' \
'(-l|--level)'{-l,--level}'+[patch level to use with rvm use / install]:number' \
'(--prefix)--prefix[path for all rvm files (~/.rvm/), with trailing slash!]:path:_files' \
'(--bin)--bin[path for binaries to be placed (~/.rvm/bin/)]:path:_files' \
'(--source)--source[src directory to use (~/.rvm/src/)]:path:_files' \
'(--archives)--archives[directory for downladed files (~/.rvm/archives/)]:path:_files' \
'-S[Specify a script file to attempt to load and run (rubydo)]:file:_files' \
'-e[Execute code from the command line]:code' \
'(-G)-G[root gem path to use]:path:_files' \
'(--gems)--gems[Used to set the gems_flag, use with remove to remove gems]' \
'(--archive)--archive[Used to set the archive_flag, use with remove to remove archive]' \
'(--patch)--patch[With MRI Rubies you may specify one or more full paths to patches]' \
'(-C|--configure)'{-C,--configure}'=[custom configure options]' \
'(--nice)--nice[process niceness (for slow computers, default 0)]:number' \
'(--ree)--ree-options[Options passed directly to ree ./installer on the command line]:options' \
'(--head)--head[with update, updates rvm to git head version]' \
'(--rubygems)--rubygems[with update, updates rubygems for selected ruby]' \
'(--default)--default[with ruby select, sets a default ruby for new shells]' \
'(--debug)--debug[Toggle debug mode on for very verbose output]' \
'(--trace)--trace[Toggle trace mode on to see EVERYTHING rvm is doing]' \
'(--force)--force[Force install, removes old install & source before install]' \
'(--summary)--summary[Used with rubydo to print out a summary of the commands run]' \
'(--latest)--latest[with gemset --dump skips version strings for latest gem]' \
'(--gems)--gems[with uninstall/remove removes gems with the interpreter]' \
'(--docs)--docs[with install, attempt to generate ri after installation]' \
'(--reconfigure)--reconfigure[Force ./configure on install even if Makefile already exists]' \
'1: :->cmds' \
'*: :->args' && ret=0
case $state in
cmds)
cmds=(
"version:show the rvm version installed in rvm_path"
"use:setup current shell to use a specific ruby version"
"reload:reload rvm source itself (useful after changing rvm source)"
"implode:(seppuku) removes the rvm installation completely. This means everything in $rvm_path (~/.rvm)."
"update:upgrades rvm to the latest version."
"reset:remove current and stored default & system settings."
"info :show the *current* environment information for current ruby"
"current:print the *current* ruby version and the name of any gemset being used."
"debug:show info plus additional information for common issues"
"install:install one or many ruby versions"
"uninstall:uninstall one or many ruby versions, leaves their sources"
"remove:uninstall one or many ruby versions and remove their sources"
"migrate:Lets you migrate all gemsets from one ruby to another."
"upgrade:Lets you upgrade from one version of a ruby to another, including migrating your gemsets semi-automatically."
"wrapper:generates a set of wrapper executables for a given ruby with the specified ruby and gemset combination. Used under the hood for passenger support and the like."
"cleanup:Lets you remove stale source folders / archives and other miscellaneous data associated with rvm."
"repair:Lets you repair parts of your environment e.g. wrappers, env files and and similar files (e.g. general maintenance)."
"snapshot:Lets your backup / restore an rvm installation in a lightweight manner."
"disk-usage:Tells you how much disk space rvm install is using."
"tools:Provides general information about the ruby environment, primarily useful when scripting rvm."
"docs:Tools to make installing ri and rdoc documentation easier."
"rvmrc:Tools related to managing rvmrc trust and loading."
"exec:runs an arbitrary command as a set operation."
"ruby:runs a named ruby file against specified and/or all rubies"
"gem:runs a gem command using selected ruby's 'gem'"
"rake:runs a rake task against specified and/or all rubies"
"tests:runs 'rake test' across selected ruby versions"
"specs:runs 'rake spec' across selected ruby versions"
"monitor:Monitor cwd for testing, run rake {spec,test} on changes."
"gemset:gemsets: http://rvm.beginrescueend.com/gemsets/"
"rubygems:Switches the installed version of rubygems for the current ruby."
"gemdir:display the path to the current gem directory (GEM_HOME)."
"srcdir:display the path to rvm source directory (may be yanked)"
"fetch:Performs an archive / src fetch only of the selected ruby."
"list:show currently installed rubies, interactive output."
"package:Install a dependency package {readline,iconv,zlib,openssl}"
"notes:Display notes, with operating system specifics."
"export:Temporarily set an environment variable in the current shell."
"unexport:Undo changes made to the environment by 'rvm export'."
)
_describe -t commands 'rvm command' cmds && ret=0
;;
args)
case $line[1] in
(use|uninstall|remove|list)
_values -S , 'rubies' $(rvm list strings | sed -e 's/ruby-\([^) ]*\)-\([^) ]*\)/ruby-\1-\2 \1-\2 \1/g') default system && ret=0
;;
(install|fetch)
_values -S , 'rubies' $(rvm list known_strings) && ret=0
;;
gemset)
if (( CURRENT == 3 )); then
_values 'gemset_commands' \
'import' \
'export' \
'create' \
'copy' \
'rename' \
'empty' \
'delete' \
'name' \
'dir' \
'list' \
'list_all' \
'gemdir' \
'install' \
'pristine' \
'clear' \
'use' \
'update' \
'unpack' \
'globalcache'
else
_values -S , 'gemsets' $(rvm gemset list | grep -v gemset 2>/dev/null)
fi
ret=0
;;
package)
if (( CURRENT == 3 )); then
_values 'package_commands' \
'install' \
'uninstall'
else
_values 'packages' \
'readline' \
'iconv' \
'curl' \
'openssl' \
'zlib' \
'autoconf' \
'ncurses' \
'pkgconfig' \
'gettext' \
'glib' \
'mono' \
'llvm' \
'libxml2' \
'libxslt' \
'libyaml'
fi
ret=0
;;
*)
(( ret )) && _message 'no more arguments'
;;
esac
;;
esac
return ret
alias rubies='rvm list rubies'
alias gemsets='rvm gemset list'
local ruby18='ruby-1.8.7-p334'
local ruby19='ruby-1.9.2-p180'
function rb18 {
if [ -z "$1" ]; then
rvm use "$ruby18"
else
rvm use "$ruby18@$1"
fi
}
_rb18() {compadd `ls -1 $rvm_path/gems | grep "^$ruby18@" | sed -e "s/^$ruby18@//" | awk '{print $1}'`}
compdef _rb18 rb18
function rb19 {
if [ -z "$1" ]; then
rvm use "$ruby19"
else
rvm use "$ruby19@$1"
fi
}
_rb19() {compadd `ls -1 $rvm_path/gems | grep "^$ruby19@" | sed -e "s/^$ruby19@//" | awk '{print $1}'`}
compdef _rb19 rb19
function rvm-update {
rvm get head
rvm reload # TODO: Reload rvm completion?
}
# TODO: Make this usable w/o rvm.
function gems {
local current_ruby=`rvm-prompt i v p`
local current_gemset=`rvm-prompt g`
gem list $@ | sed \
-Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$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$current_gemset$/$fg[green]&$reset_color/g"
}
# Based on code from Joseph M. Reagle
# http://www.cygwin.com/ml/cygwin/2001-06/msg00537.html
#
# INSTRUCTIONS
#
# To enabled agent forwarding support add the following to
# your .zshrc file:
#
# zstyle :omz:plugins:ssh-agent agent-forwarding on
#
# To load multiple identies use the identities style, For
# example:
#
# zstyle :omz:plugins:ssh-agent id_rsa id_rsa2 id_github
#
#
# CREDITS
#
# Based on code from Joseph M. Reagle
# http://www.cygwin.com/ml/cygwin/2001-06/msg00537.html
#
# Agent forwarding support based on ideas from
# Florent Thoumie and Jonas Pfenniger
#
local SSH_ENV=$HOME/.ssh/environment-$HOST
local _plugin__ssh_env=$HOME/.ssh/environment-$HOST
local _plugin__forwarding
function start_agent {
/usr/bin/env ssh-agent | sed 's/^echo/#echo/' > ${SSH_ENV}
chmod 600 ${SSH_ENV}
. ${SSH_ENV} > /dev/null
/usr/bin/ssh-add;
function _plugin__start_agent()
{
local -a identities
# start ssh-agent and setup environment
/usr/bin/env ssh-agent | sed 's/^echo/#echo/' > ${_plugin__ssh_env}
chmod 600 ${_plugin__ssh_env}
. ${_plugin__ssh_env} > /dev/null
# load identies
zstyle -a :omz:plugins:ssh-agent identities identities
echo starting...
/usr/bin/ssh-add $HOME/.ssh/${^identities}
}
# Source SSH settings, if applicable
# test if agent-forwarding is enabled
zstyle -b :omz:plugins:ssh-agent agent-forwarding _plugin__forwarding
if [[ ${_plugin__forwarding} == "yes" && -n "$SSH_AUTH_SOCK" ]]; then
# Add a nifty symlink for screen/tmux if agent forwarding
[[ -L $SSH_AUTH_SOCK ]] || ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USER-screen
if [ -f "${SSH_ENV}" ]; then
. ${SSH_ENV} > /dev/null
elif [ -f "${_plugin__ssh_env}" ]; then
# Source SSH settings, if applicable
. ${_plugin__ssh_env} > /dev/null
ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
start_agent;
_plugin__start_agent;
}
else
start_agent;
_plugin__start_agent;
fi
# tidy up after ourselves
unfunction _plugin__start_agent
unset _plugin__forwarding
unset _plugin__ssh_env
function svn_prompt_info {
if [[ -d .svn ]]; then
if [ in_svn ]; then
echo "$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_PREFIX\
$ZSH_THEME_REPO_NAME_COLOR$(svn_get_repo_name)$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR$(svn_dirty)$ZSH_PROMPT_BASE_COLOR"
fi
......@@ -13,7 +13,7 @@ function in_svn() {
}
function svn_get_repo_name {
if [ is_svn ]; then
if [ in_svn ]; then
svn info | sed -n 's/Repository\ Root:\ .*\///p' | read SVN_ROOT
svn info | sed -n "s/URL:\ .*$SVN_ROOT\///p" | sed "s/\/.*$//"
......@@ -21,14 +21,14 @@ function svn_get_repo_name {
}
function svn_get_rev_nr {
if [ is_svn ]; then
if [ in_svn ]; then
svn info 2> /dev/null | sed -n s/Revision:\ //p
fi
}
function svn_dirty_choose {
if [ is_svn ]; then
s=$(svn status 2>/dev/null)
if [ in_svn ]; then
s=$(svn status|grep -E '^\s*[ACDIM!?L]' 2>/dev/null)
if [ $s ]; then
echo $1
else
......@@ -39,4 +39,4 @@ function svn_dirty_choose {
function svn_dirty {
svn_dirty_choose $ZSH_THEME_SVN_PROMPT_DIRTY $ZSH_THEME_SVN_PROMPT_CLEAN
}
\ No newline at end of file
}
#compdef task
#
# zsh completion for taskwarrior
#
# Copyright 2010 - 2011 Johannes Schlatow
# 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
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# 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
# this program; if not, write to the
#
# Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor,
# Boston, MA
# 02110-1301
# USA
#
typeset -g _task_cmds _task_projects _task_tags _task_config _task_modifiers
_task_projects=($(task _projects))
_task_tags=($(task _tags))
_task_ids=($(task _ids))
_task_config=($(task _config))
_task_modifiers=(
'before' \
'after' \
'none' \
'any' \
'is' \
'isnt' \
'has' \
'hasnt' \
'startswith' \
'endswith' \
'word' \
'noword'
)
_task_cmds=($(task _commands))
_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() {
_arguments -s -S \
"*::task command:_task_commands"
return 0
}
local -a reply args word
word=$'[^\0]#\0'
# priorities
local -a task_priorities
_regex_words values 'task priorities' \
'H:High' \
'M:Middle' \
'L:Low'
task_priorities=("$reply[@]")
# projects
local -a task_projects
task_projects=(
/"$word"/
":values:task projects:compadd -a _task_projects"
)
local -a _task_dates
_regex_words values 'task dates' \
'tod*ay:Today' \
'yes*terday:Yesterday' \
'tom*orrow:Tomorrow' \
'sow:Start of week' \
'soww:Start of work week' \
'socw:Start of calendar week' \
'som:Start of month' \
'soy:Start of year' \
'eow:End of week' \
'eoww:End of work week' \
'eocw:End of calendar week' \
'eom:End of month' \
'eoy:End of year' \
'mon:Monday' \
'tue:Tuesday'\
'wed:Wednesday' \
'thu:Thursday' \
'fri:Friday' \
'sat:Saturday' \
'sun:Sunday'
_task_dates=("$reply[@]")
local -a _task_reldates
_regex_words values 'task reldates' \
'hrs:n hours' \
'day:n days' \
'1st:first' \
'2nd:second' \
'3rd:third' \
'th:4th, 5th, etc.' \
'wks:weeks'
_task_reldates=("$reply[@]")
task_dates=(
\( "$_task_dates[@]" \|
\( /$'[0-9][0-9]#'/- \( "$_task_reldates[@]" \) \)
\)
)
_regex_words values 'task frequencies' \
'daily:Every day' \
'day:Every day' \
'weekdays:Every day skipping weekend days' \
'weekly:Every week' \
'biweekly:Every two weeks' \
'fortnight:Every two weeks' \
'quarterly:Every three months' \
'semiannual:Every six months' \
'annual:Every year' \
'yearly:Every year' \
'biannual:Every two years' \
'biyearly:Every two years'
_task_freqs=("$reply[@]")
local -a _task_frequencies
_regex_words values 'task frequencies' \
'd:days' \
'w:weeks' \
'q:quarters' \
'y:years'
_task_frequencies=("$reply[@]")
task_freqs=(
\( "$_task_freqs[@]" \|
\( /$'[0-9][0-9]#'/- \( "$_task_frequencies[@]" \) \)
\)
)
# attributes
local -a task_attributes
_regex_words -t ':' default 'task attributes' \
'pro*ject:Project name:$task_projects' \
'du*e:Due date:$task_dates' \
'wa*it:Date until task becomes pending:$task_dates' \
're*cur:Recurrence frequency:$task_freqs' \
'pri*ority:priority:$task_priorities' \
'un*til:Recurrence end date:$task_dates' \
'fg:Foreground color' \
'bg:Background color' \
'li*mit:Desired number of rows in report'
task_attributes=("$reply[@]")
args=(
\( "$task_attributes[@]" \|
\( /'(project|due|wait|recur|priority|until|fg|bg|limit).'/- \( /$'[^:]#:'/ ":default:modifiers:compadd -S ':' -a _task_modifiers" \) \) \|
\( /'(rc).'/- \( /$'[^:]#:'/ ":arguments:config:compadd -S ':' -a _task_config" \) \) \|
\( /'(+|-)'/- \( /"$word"/ ":values:remove tag:compadd -a _task_tags" \) \) \|
\( /"$word"/ \)
\) \#
)
_regex_arguments _task_attributes "${args[@]}"
## task commands
# default completion
(( $+functions[_task_default] )) ||
_task_default() {
_task_attributes "$@"
}
# commands expecting an ID
(( $+functions[_task_id] )) ||
_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
(( $+functions[_task_merge] )) ||
_task_merge() {
# TODO match URIs in .taskrc
_files
}
# push completion
(( $+functions[_task_push] )) ||
_task_push() {
# TODO match URIs in .taskrc
_files
}
# pull completion
(( $+functions[_task_pull] )) ||
_task_pull() {
# TODO match URIs in .taskrc
_files
}
# modify (task [0-9]* ...) completion
(( $+functions[_task_modify] )) ||
_task_modify() {
_describe -t commands 'task command' _task_idCmdsDesc
_task_attributes "$@"
}
## first level completion => task sub-command completion
(( $+functions[_task_commands] )) ||
_task_commands() {
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
_call_function ret _task_id
else
_call_function ret _task_${cmd} ||
_call_function ret _task_default ||
_message "No command remaining."
fi
else
_message "Unknown subcommand ${cmd}"
fi
return ret
fi
}
################################################################################
# Author: Pete Clark
# Email: pete[dot]clark[at]gmail[dot]com
# Version: 0.1 (05/24/2011)
# License: WTFPL<http://sam.zoy.org/wtfpl/>
#
# This oh-my-zsh plugin adds smart tab completion for
# TaskWarrior<http://taskwarrior.org/>. It uses the zsh tab completion
# script (_task) distributed with TaskWarrior for the completion definitions.
#
# Typing task[tabtab] will give you a list of current tasks, task 66[tabtab]
# gives a list of available modifications for that task, etc.
################################################################################
zstyle ':completion:*:*:task:*' verbose yes
zstyle ':completion:*:*:task:*:descriptions' format '%U%B%d%b%u'
zstyle ':completion:*:*:task:*' group-name ''
alias t=task
compdef _task t=task
alias et='mate .'
alias ett='mate app config lib db public spec test Rakefile Capfile Todo'
alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo'
alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo'
# TextMate
alias et='mate . &'
alias ett='mate app config lib db public spec test Rakefile Capfile Todo &'
alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo &'
alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo &'
# Editor Ruby file in TextMate
# Edit Ruby app in TextMate
alias mr='mate CHANGELOG app config db lib public script spec test'
function tm() {
......
#compdef thor
#autoload
compadd `thor list | grep thor | cut -d " " -f 2`
# Path to your oh-my-zsh configuration.
export ZSH=$HOME/.oh-my-zsh
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
export ZSH_THEME="robbyrussell"
ZSH_THEME="robbyrussell"
# Set to this to use case-sensitive completion
# export CASE_SENSITIVE="true"
# CASE_SENSITIVE="true"
# Comment this out to disable weekly auto-update checks
# export DISABLE_AUTO_UPDATE="true"
# DISABLE_AUTO_UPDATE="true"
# Uncomment following line if you want to disable colors in ls
# export DISABLE_LS_COLORS="true"
# DISABLE_LS_COLORS="true"
# Uncomment following line if you want to disable autosetting terminal title.
# export DISABLE_AUTO_TITLE="true"
# DISABLE_AUTO_TITLE="true"
# Uncomment following line if you want red dots to be displayed while waiting for completion
# COMPLETION_WAITING_DOTS="true"
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Example format: plugins=(rails git textmate ruby lighthouse)
......
local user='%{$fg[magenta]%}%n@%{$fg[magenta]%}%m%{$reset_color%}'
local pwd='%{$fg[blue]%}%~%{$reset_color%}'
local rvm='%{$fg[green]%}‹$(rvm-prompt i v g)›%{$reset_color%}'
local return_code='%(?..%{$fg[red]%}%? ↵%{$reset_color%})'
local git_branch='$(git_prompt_status)%{$reset_color%}$(git_prompt_info)%{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY=""
ZSH_THEME_GIT_PROMPT_CLEAN=""
ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚"
ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹"
ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖"
ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜"
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭"
PROMPT="${user} ${pwd}$ "
RPROMPT="${return_code} ${git_branch} ${rvm}"
# https://github.com/blinks zsh theme
function _prompt_char() {
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
echo "%{%F{blue}%}±%{%f%k%b%}"
else
echo ' '
fi
}
ZSH_THEME_GIT_PROMPT_PREFIX=" [%{%B%F{blue}%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{%f%k%b%K{black}%B%F{green}%}]"
ZSH_THEME_GIT_PROMPT_DIRTY=" %{%F{red}%}*%{%f%k%b%}"
ZSH_THEME_GIT_PROMPT_CLEAN=""
PROMPT='%{%f%k%b%}
%{%K{black}%B%F{green}%}%n%{%B%F{blue}%}@%{%B%F{cyan}%}%m%{%B%F{green}%} %{%b%F{yellow}%K{black}%}%~%{%B%F{green}%}$(git_prompt_info)%E%{%f%k%b%}
%{%K{black}%}$(_prompt_char)%{%K{black}%} %#%{%f%k%b%} '
RPROMPT='!%{%B%F{cyan}%}%!%{%f%k%b%}'
if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
PROMPT='%{$fg[$NCOLOR]%}%n%{$reset_color%}@%{$fg[cyan]%}%m\
%{$reset_color%}:%{$fg[magenta]%}%~\
$(git_prompt_info) \
%{$fg[red]%}%(!.#.»)%{$reset_color%} '
PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
RPS1='${return_code}'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}("
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}○%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}⚡%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg[yellow]%})%{$reset_color%}"
......@@ -3,7 +3,18 @@
local user_color='green'; [ $UID -eq 0 ] && user_color='red'
PROMPT='%n@%m %{$fg[$user_color]%}%~%{$reset_color%}%(!.#.>) '
PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
RPS1='%(?..%{$fg[red]%}%? ↵%{$reset_color%})$(git_prompt_info)'
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[cyan]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
local return_status="%{$fg_bold[red]%}%(?..%?)%{$reset_color%}"
RPROMPT='${return_status}$(git_prompt_info)$(git_prompt_status)%{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX=" "
ZSH_THEME_GIT_PROMPT_SUFFIX=""
ZSH_THEME_GIT_PROMPT_DIRTY=""
ZSH_THEME_GIT_PROMPT_CLEAN=""
ZSH_THEME_GIT_PROMPT_ADDED="%{$fg_bold[green]%}+"
ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg_bold[blue]%}!"
ZSH_THEME_GIT_PROMPT_DELETED="%{$fg_bold[red]%}-"
ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg_bold[magenta]%}>"
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg_bold[yellow]%}#"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[cyan]%}?"
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