summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/bundler/bundler.plugin.zsh2
-rw-r--r--plugins/bwana/bwana.plugin.zsh13
-rw-r--r--plugins/git-remote-branch/git-remote-branch.plugin.zsh18
-rw-r--r--plugins/git/git.plugin.zsh19
-rw-r--r--plugins/history/history.plugin.zsh8
-rw-r--r--plugins/jira/jira.plugin.zsh34
-rw-r--r--plugins/knife/_knife6
-rw-r--r--plugins/last-working-dir/last-working-dir.plugin.zsh1
-rw-r--r--plugins/lol/lol.plugin.zsh1
-rw-r--r--plugins/osx/osx.plugin.zsh63
-rw-r--r--plugins/rails/rails.plugin.zsh1
-rwxr-xr-xplugins/sublime/sublime.plugin.zsh5
-rw-r--r--plugins/symfony/symfony.plugin.zsh13
-rw-r--r--plugins/urltools/urltools.plugin.zsh31
-rw-r--r--plugins/vi-mode/vi-mode.plugin.zsh20
-rw-r--r--plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh4
16 files changed, 215 insertions, 24 deletions
diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh
index 2305c4979..f9843696b 100644
--- a/plugins/bundler/bundler.plugin.zsh
+++ b/plugins/bundler/bundler.plugin.zsh
@@ -6,7 +6,7 @@ alias bu="bundle update"
# The following is based on https://github.com/gma/bundler-exec
-bundled_commands=(annotate cap capify cucumber foreman guard middleman nanoc rackup rainbows rake rspec ruby shotgun spec spork thin thor unicorn unicorn_rails puma)
+bundled_commands=(annotate cap capify cucumber foreman guard middleman nanoc rackup rainbows rake rspec ruby shotgun spec spork thin thor unicorn unicorn_rails puma zeus)
## Functions
diff --git a/plugins/bwana/bwana.plugin.zsh b/plugins/bwana/bwana.plugin.zsh
new file mode 100644
index 000000000..455da8621
--- /dev/null
+++ b/plugins/bwana/bwana.plugin.zsh
@@ -0,0 +1,13 @@
+#
+# Requires http://www.bruji.com/bwana/
+#
+if [[ -e /Applications/Bwana.app ]] ||
+ ( system_profiler -detailLevel mini SPApplicationsDataType | grep -q Bwana )
+then
+ function man() {
+ open "man:$1"
+ }
+else
+ echo "Bwana lets you read man files in Safari through a man: URI scheme"
+ echo "To use it within Zsh, install it from http://www.bruji.com/bwana/"
+fi
diff --git a/plugins/git-remote-branch/git-remote-branch.plugin.zsh b/plugins/git-remote-branch/git-remote-branch.plugin.zsh
new file mode 100644
index 000000000..ff98cbf87
--- /dev/null
+++ b/plugins/git-remote-branch/git-remote-branch.plugin.zsh
@@ -0,0 +1,18 @@
+_git_remote_branch() {
+ ref=$(git symbolic-ref HEAD 2> /dev/null)
+ if [[ -n $ref ]]; then
+ if (( CURRENT == 2 )); then
+ # first arg: operation
+ compadd create publish rename delete track
+ elif (( CURRENT == 3 )); then
+ # second arg: remote branch name
+ compadd `git branch -r | grep -v HEAD | sed "s/.*\///" | sed "s/ //g"`
+ elif (( CURRENT == 4 )); then
+ # third arg: remote name
+ compadd `git remote`
+ fi
+ else;
+ _files
+ fi
+}
+compdef _git_remote_branch grb
diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh
index 6b7bd374c..154aa6db1 100644
--- a/plugins/git/git.plugin.zsh
+++ b/plugins/git/git.plugin.zsh
@@ -9,6 +9,7 @@ alias gup='git pull --rebase'
compdef _git gup=git-fetch
alias gp='git push'
compdef _git gp=git-push
+alias gd='git diff'
gdv() { git diff -w "$@" | view - }
compdef _git gdv=git-diff
alias gc='git commit -v'
@@ -18,19 +19,32 @@ compdef _git gca=git-commit
alias gco='git checkout'
compdef _git gco=git-checkout
alias gcm='git checkout master'
+alias gr='git remote'
+compdef _git gr=git-remote
+alias grv='git remote -v'
+compdef _git grv=git-remote
+alias grmv='git remote rename'
+compdef _git grmv=git-remote
+alias grrm='git remote remove'
+compdef _git grrm=git-remote
+alias grset='git remote set-url'
+compdef _git grset=git-remote
+alias grup='git remote update'
+compdef _git grset=git-remote
alias gb='git branch'
compdef _git gb=git-branch
alias gba='git branch -a'
compdef _git gba=git-branch
alias gcount='git shortlog -sn'
compdef gcount=git
+alias gcl='git config --list'
alias gcp='git cherry-pick'
compdef _git gcp=git-cherry-pick
alias glg='git log --stat --max-count=5'
compdef _git glg=git-log
alias glgg='git log --graph --max-count=5'
compdef _git glgg=git-log
-alias glgga='git log --graph --decorate --all'
+alias glgga='git log --graph --decorate --all'
compdef _git glgga=git-log
alias gss='git status -s'
compdef _git gss=git-status
@@ -42,13 +56,12 @@ alias grh='git reset HEAD'
alias grhh='git reset HEAD --hard'
alias gwc='git whatchanged -p --abbrev-commit --pretty=medium'
alias gf='git ls-files | grep'
+alias gpoat='git push origin --all && git push origin --tags'
# Will cd into the top of the current repository
# or submodule.
alias grt='cd $(git rev-parse --show-toplevel || echo ".")'
-
-
# Git and svn mix
alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
compdef git-svn-dcommit-push=git
diff --git a/plugins/history/history.plugin.zsh b/plugins/history/history.plugin.zsh
new file mode 100644
index 000000000..0f4aa4b10
--- /dev/null
+++ b/plugins/history/history.plugin.zsh
@@ -0,0 +1,8 @@
+alias h='history'
+
+function hs
+{
+ history | grep $*
+}
+
+alias hsi='hs -i'
diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh
index de8d10529..b91f93c95 100644
--- a/plugins/jira/jira.plugin.zsh
+++ b/plugins/jira/jira.plugin.zsh
@@ -1,20 +1,36 @@
# To use: add a .jira-url file in the base of your project
+# You can also set JIRA_URL in your .zshrc or put .jira-url in your home directory
+# .jira-url in the current directory takes precedence
+#
+# If you use Rapid Board, set:
+#JIRA_RAPID_BOARD="yes"
+# in you .zshrc
+#
# Setup: cd to/my/project
# echo "https://name.jira.com" >> .jira-url
# Usage: jira # opens a new issue
# jira ABC-123 # Opens an existing issue
open_jira_issue () {
- if [ ! -f .jira-url ]; then
- echo "There is no .jira-url file in the current directory..."
- return 0;
+ if [ -f .jira-url ]; then
+ jira_url=$(cat .jira-url)
+ elif [ -f ~/.jira-url ]; then
+ jira_url=$(cat ~/.jira-url)
+ elif [[ "x$JIRA_URL" != "x" ]]; then
+ jira_url=$JIRA_URL
else
- jira_url=$(cat .jira-url);
- if [ -z "$1" ]; then
- echo "Opening new issue";
- `open $jira_url/secure/CreateIssue!default.jspa`;
+ echo "JIRA url is not specified anywhere."
+ return 0
+ fi
+
+ if [ -z "$1" ]; then
+ echo "Opening new issue"
+ `open $jira_url/secure/CreateIssue!default.jspa`
+ else
+ echo "Opening issue #$1"
+ if [[ "x$JIRA_RAPID_BOARD" = "yes" ]]; then
+ `open $jira_url/issues/$1`
else
- echo "Opening issue #$1";
- `open $jira_url/browse/$1`;
+ `open $jira_url/browse/$1`
fi
fi
}
diff --git a/plugins/knife/_knife b/plugins/knife/_knife
index 8453af5be..dec491257 100644
--- a/plugins/knife/_knife
+++ b/plugins/knife/_knife
@@ -170,7 +170,11 @@ _chef_environments_remote() {
# The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server
_chef_cookbooks_local() {
- (for i in $( grep cookbook_path $HOME/.chef/knife.rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' ); do ls $i; done)
+ local knife_rb="$HOME/.chef/knife.rb"
+ if [ -f ./.chef/knife.rb ]; then
+ knife_rb="./.chef/knife.rb"
+ fi
+ (for i in $( grep cookbook_path $knife_rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' ); do ls $i; done)
}
# This function extracts the available cookbook versions on the chef server
diff --git a/plugins/last-working-dir/last-working-dir.plugin.zsh b/plugins/last-working-dir/last-working-dir.plugin.zsh
index 5b3121d11..190bc279d 100644
--- a/plugins/last-working-dir/last-working-dir.plugin.zsh
+++ b/plugins/last-working-dir/last-working-dir.plugin.zsh
@@ -4,6 +4,7 @@
# Flag indicating if we've previously jumped to last directory.
typeset -g ZSH_LAST_WORKING_DIRECTORY
+mkdir -p "$ZSH/cache"
local cache_file="$ZSH/cache/last-working-dir"
# Updates the last directory once directory is changed.
diff --git a/plugins/lol/lol.plugin.zsh b/plugins/lol/lol.plugin.zsh
index 697f98d66..ae065c12f 100644
--- a/plugins/lol/lol.plugin.zsh
+++ b/plugins/lol/lol.plugin.zsh
@@ -5,6 +5,7 @@ alias wtf='dmesg'
alias onoz='cat /var/log/errors.log'
alias rtfm='man'
+alias :3='echo'
alias visible='echo'
alias invisible='cat'
alias moar='more'
diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh
index 682bb2667..f278d4f8d 100644
--- a/plugins/osx/osx.plugin.zsh
+++ b/plugins/osx/osx.plugin.zsh
@@ -2,10 +2,9 @@
# FILE: osx.plugin.zsh
# DESCRIPTION: oh-my-zsh plugin file.
# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com)
-# VERSION: 1.0.1
+# VERSION: 1.1.0
# ------------------------------------------------------------------------------
-
function tab() {
local command="cd \\\"$PWD\\\""
(( $# > 0 )) && command="${command}; $*"
@@ -35,9 +34,67 @@ EOF
launch session "Default Session"
set current_session to current session
tell current_session
- write text "${command}"
+ write text "${command}; clear;"
+ end tell
+ end tell
+ end tell
+EOF
+ }
+}
+
+function vsplit_tab() {
+ 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
+EOF
+ )
+
+ [[ "$the_app" == 'iTerm' ]] && {
+ osascript 2>/dev/null <<EOF
+ tell application "iTerm" to activate
+
+ tell application "System Events"
+ tell process "iTerm"
+ tell menu item "Split Vertically With Current Profile" of menu "Shell" of menu bar item "Shell" of menu bar 1
+ click
+ end tell
+ end tell
+ keystroke "${command}; clear;"
+ keystroke return
+ end tell
+EOF
+ }
+}
+
+function split_tab() {
+ 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
+EOF
+ )
+
+ [[ "$the_app" == 'iTerm' ]] && {
+ osascript 2>/dev/null <<EOF
+ tell application "iTerm" to activate
+
+ tell application "System Events"
+ tell process "iTerm"
+ tell menu item "Split Horizontally With Current Profile" of menu "Shell" of menu bar item "Shell" of menu bar 1
+ click
end tell
end tell
+ keystroke "${command}; clear;"
+ keystroke return
end tell
EOF
}
diff --git a/plugins/rails/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh
index cd232a6ae..d3849b4f4 100644
--- a/plugins/rails/rails.plugin.zsh
+++ b/plugins/rails/rails.plugin.zsh
@@ -6,6 +6,7 @@ alias sr='ruby script/runner'
alias ssp='ruby script/spec'
alias rdbm='rake db:migrate'
alias rdbtp='rake db:test:prepare'
+alias migrate='rake db:migrate && rake db:test:prepare'
alias sc='ruby script/console'
alias sd='ruby script/server --debugger'
alias devlog='tail -f log/development.log'
diff --git a/plugins/sublime/sublime.plugin.zsh b/plugins/sublime/sublime.plugin.zsh
index 9af70e7de..1b2cbcdce 100755
--- a/plugins/sublime/sublime.plugin.zsh
+++ b/plugins/sublime/sublime.plugin.zsh
@@ -5,10 +5,11 @@ local _sublime_darwin_subl=/Applications/Sublime\ Text\ 2.app/Contents/SharedSup
if [[ $('uname') == 'Linux' ]]; then
if [ -f '/usr/bin/sublime_text' ]; then
- alias st='/usr/bin/sublime_text&'
+ st_run() { nohup /usr/bin/sublime_text $@ > /dev/null & }
else
- alias st='/usr/bin/sublime-text&'
+ st_run() { nohup /usr/bin/sublime-text $@ > /dev/null & }
fi
+alias st=st_run
elif [[ $('uname') == 'Darwin' ]]; then
# Check if Sublime is installed in user's home application directory
if [[ -a $HOME/${_sublime_darwin_subl} ]]; then
diff --git a/plugins/symfony/symfony.plugin.zsh b/plugins/symfony/symfony.plugin.zsh
new file mode 100644
index 000000000..9de767548
--- /dev/null
+++ b/plugins/symfony/symfony.plugin.zsh
@@ -0,0 +1,13 @@
+# symfony basic command completion
+
+_symfony_get_command_list () {
+ ./symfony | sed "1,/Available tasks/d" | awk 'BEGIN { cat=null; } /^[A-Za-z]+$/ { cat = $1; } /^ :[a-z]+/ { print cat $1; }'
+}
+
+_symfony () {
+ if [ -f symfony ]; then
+ compadd `_symfony_get_command_list`
+ fi
+}
+
+compdef _symfony symfony
diff --git a/plugins/urltools/urltools.plugin.zsh b/plugins/urltools/urltools.plugin.zsh
index 3de74ae3d..4ddfff8ce 100644
--- a/plugins/urltools/urltools.plugin.zsh
+++ b/plugins/urltools/urltools.plugin.zsh
@@ -4,6 +4,33 @@
# Taken from:
# http://ruslanspivak.com/2010/06/02/urlencode-and-urldecode-from-a-command-line/
-alias urlencode='node -e "console.log(encodeURIComponent(process.argv[1]))"'
+if [[ $(whence $URLTOOLS_METHOD) = "" ]]; then
+ URLTOOLS_METHOD=""
+fi
-alias urldecode='node -e "console.log(decodeURIComponent(process.argv[1]))"'
+if [[ $(whence node) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xnode" ) ]]; then
+ alias urlencode='node -e "console.log(encodeURIComponent(process.argv[1]))"'
+ alias urldecode='node -e "console.log(decodeURIComponent(process.argv[1]))"'
+elif [[ $(whence python) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xpython" ) ]]; then
+ alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1])"'
+ alias urldecode='python -c "import sys, urllib as ul; print ul.unquote_plus(sys.argv[1])"'
+elif [[ $(whence ruby) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xruby" ) ]]; then
+ alias urlencode='ruby -r cgi -e "puts CGI.escape(ARGV[0])"'
+ alias urldecode='ruby -r cgi -e "puts CGI.unescape(ARGV[0])"'
+elif [[ $(whence php) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xphp" ) ]]; then
+ alias urlencode='php -r "echo rawurlencode(\$argv[1]); echo \"\n\";"'
+ alias urldecode='php -r "echo rawurldecode(\$argv[1]); echo \"\\n\";"'
+elif [[ $(whence perl) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xperl" ) ]]; then
+ if perl -MURI::Encode -e 1&> /dev/null; then
+ alias urlencode='perl -MURI::Encode -ep "uri_encode($ARGV[0]);"'
+ alias urldecode='perl -MURI::Encode -ep "uri_decode($ARGV[0]);"'
+ elif perl -MURI::Escape -e 1 &> /dev/null; then
+ alias urlencode='perl -MURI::Escape -ep "uri_escape($ARGV[0]);"'
+ alias urldecode='perl -MURI::Escape -ep "uri_unescape($ARGV[0]);"'
+ else
+ alias urlencode="perl -e '\$new=\$ARGV[0]; \$new =~ s/([^A-Za-z0-9])/sprintf(\"%%%02X\", ord(\$1))/seg; print \"\$new\n\";'"
+ alias urldecode="perl -e '\$new=\$ARGV[0]; \$new =~ s/\%([A-Fa-f0-9]{2})/pack(\"C\", hex(\$1))/seg; print \"\$new\n\";'"
+ fi
+fi
+
+unset URLTOOLS_METHOD \ No newline at end of file
diff --git a/plugins/vi-mode/vi-mode.plugin.zsh b/plugins/vi-mode/vi-mode.plugin.zsh
index c47ab7211..f91be70e4 100644
--- a/plugins/vi-mode/vi-mode.plugin.zsh
+++ b/plugins/vi-mode/vi-mode.plugin.zsh
@@ -1,8 +1,26 @@
-function zle-line-init zle-keymap-select {
+# Ensures that $terminfo values are valid and updates editor information when
+# the keymap changes.
+function zle-keymap-select zle-line-init zle-line-finish {
+ # The terminal must be in application mode when ZLE is active for $terminfo
+ # values to be valid.
+ if (( $+terminfo[smkx] && $+terminfo[rmkx] )); then
+ case "$0" in
+ (zle-line-init)
+ # Enable terminal application mode.
+ echoti smkx
+ ;;
+ (zle-line-finish)
+ # Disable terminal application mode.
+ echoti rmkx
+ ;;
+ esac
+ fi
zle reset-prompt
+ zle -R
}
zle -N zle-line-init
+zle -N zle-line-finish
zle -N zle-keymap-select
bindkey -v
diff --git a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
index a5abb77c3..0ed2565b4 100644
--- a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
+++ b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
@@ -1,4 +1,4 @@
-wrapsource=`which virtualenvwrapper.sh`
+wrapsource=`which virtualenvwrapper_lazy.sh`
if [[ -f "$wrapsource" ]]; then
source $wrapsource
@@ -36,5 +36,5 @@ if [[ -f "$wrapsource" ]]; then
}
fi
else
- print "zsh virtualenvwrapper plugin: Cannot find virtualenvwrapper.sh. Please install with \`pip install virtualenvwrapper\`."
+ print "zsh virtualenvwrapper plugin: Cannot find virtualenvwrapper_lazy.sh. Please install with \`pip install virtualenvwrapper\`."
fi