summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/bundler/bundler.plugin.zsh1
-rw-r--r--plugins/capistrano/_capistrano6
-rw-r--r--plugins/capistrano/capistrano.plugin.zsh2
-rw-r--r--plugins/dircycle/dircycle.plugin.zsh16
-rw-r--r--plugins/github/README.md46
-rw-r--r--plugins/github/_github40
-rw-r--r--plugins/github/github.plugin.zsh101
-rw-r--r--plugins/gradle/gradle.plugin.zsh40
-rw-r--r--plugins/mercurial/README.md24
-rw-r--r--plugins/wp-cli/README.md4
-rw-r--r--plugins/wp-cli/wp-cli.plugin.zsh4
11 files changed, 123 insertions, 161 deletions
diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh
index dfff6956e..382a1a471 100644
--- a/plugins/bundler/bundler.plugin.zsh
+++ b/plugins/bundler/bundler.plugin.zsh
@@ -2,6 +2,7 @@ alias be="bundle exec"
alias bl="bundle list"
alias bp="bundle package"
alias bo="bundle open"
+alias bout="bundle outdated"
alias bu="bundle update"
alias bi="bundle_install"
alias bcn="bundle clean"
diff --git a/plugins/capistrano/_capistrano b/plugins/capistrano/_capistrano
index c19c20b7a..a79e47b2f 100644
--- a/plugins/capistrano/_capistrano
+++ b/plugins/capistrano/_capistrano
@@ -1,7 +1,7 @@
-#compdef shipit
+#compdef capit
#autoload
-# Added `shipit` because `cap` is a reserved word. `cap` completion doesn't work.
+# Added `capit` because `cap` is a reserved word. `cap` completion doesn't work.
# http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fcap-Module
local curcontext="$curcontext" state line ret=1
@@ -14,7 +14,7 @@ _arguments -C \
_cap_tasks() {
if [[ -f config/deploy.rb || -f Capfile ]]; then
if [[ ! -f .cap_tasks~ ]]; then
- shipit --tasks | sed 's/\(\[\)\(.*\)\(\]\)/\2:/' | awk '{command=$2; $1=$2=$3=""; gsub(/^[ \t\r\n]+/, "", $0); gsub(":", "\\:", command); print command"["$0"]"}' > .cap_tasks~
+ capit --tasks | sed 's/\(\[\)\(.*\)\(\]\)/\2:/' | awk '{command=$2; $1=$2=$3=""; gsub(/^[ \t\r\n]+/, "", $0); gsub(":", "\\:", command); print command"["$0"]"}' > .cap_tasks~
fi
OLD_IFS=$IFS
diff --git a/plugins/capistrano/capistrano.plugin.zsh b/plugins/capistrano/capistrano.plugin.zsh
index c85eb474c..0b5559791 100644
--- a/plugins/capistrano/capistrano.plugin.zsh
+++ b/plugins/capistrano/capistrano.plugin.zsh
@@ -1,7 +1,7 @@
# Added `shipit` because `cap` is a reserved word. `cap` completion doesn't work.
# http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fcap-Module
-func shipit() {
+func capit() {
if [ -f Gemfile ]
then
bundle exec cap $*
diff --git a/plugins/dircycle/dircycle.plugin.zsh b/plugins/dircycle/dircycle.plugin.zsh
index 1e31105b1..8a406b54d 100644
--- a/plugins/dircycle/dircycle.plugin.zsh
+++ b/plugins/dircycle/dircycle.plugin.zsh
@@ -27,11 +27,11 @@ insert-cycledright () {
zle -N insert-cycledright
-# add key bindings for iTerm2
-if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
- bindkey "^[[1;6D" insert-cycledleft
- bindkey "^[[1;6C" insert-cycledright
-else
- bindkey "\e[1;6D" insert-cycledleft
- bindkey "\e[1;6C" insert-cycledright
-fi \ No newline at end of file
+# These sequences work for xterm, Apple Terminal.app, and probably others.
+# Not for rxvt-unicode, but it doesn't seem differentiate Ctrl-Shift-Arrow
+# from plain Shift-Arrow, at least by default.
+# iTerm2 does not have these key combinations defined by default; you will need
+# to add them under "Keys" in your profile if you want to use this. You can do
+# this conveniently by loading the "xterm with Numeric Keypad" preset.
+bindkey "\e[1;6D" insert-cycledleft
+bindkey "\e[1;6C" insert-cycledright
diff --git a/plugins/github/README.md b/plugins/github/README.md
new file mode 100644
index 000000000..21b7367f7
--- /dev/null
+++ b/plugins/github/README.md
@@ -0,0 +1,46 @@
+# github
+
+This plugin supports working with GitHub the command line. It provides a few things:
+
+* Sets up the `hub` wrapper and completions for the `git` command if you have `hub` installed.
+* Completion for the `github` Ruby gem.
+* Convenience functions for working with repos and URLs.
+
+### Functions
+
+* `empty_gh` - Creates a new empty repo (with a `README.md`) and pushes it to GitHub
+* `new_gh` - Initializes an existing directory as a repo and pushes it to GitHub
+* `exist_gh` - Takes an existing repo and pushes it to GitHub
+* `git.io` - Shortens a URL using [git.io](http://git.io)
+
+
+## Installation
+
+[Hub](http://github.com/github/hub) needs to be installed if you want to use it. On OS X with Homebrew, this can be done with `brew install hub`. The `hub` completion definition needs to be added to your `$FPATH` before initializing OMZ.
+
+The [`github` Ruby gem](http://github.com/defunkt/github-gem) needs to be installed if you want to use it.
+
+### Configuration
+
+These settings affect `github`'s behavior.
+
+#### Environment variables
+
+* `$GITHUB_USER`
+* `$GITHUB_PASSWORD`
+
+#### Git configuration options
+
+* `github.user` - GitHub username for repo operations
+
+See `man hub` for more details.
+
+### Homebrew installation note
+
+If you have installed `hub` using Homebrew, its completions may not be on your `$FPATH` if you are using the system `zsh`. Homebrew installs `zsh` completion definitions to `/usr/local/share/zsh/site-functions`, which on `$FPATH` for the Homebrew-installed `zsh`, but not for the system `zsh`. If you want it to work with the system `zsh`, add this to your `~/.zshrc` before it sources `oh-my-zsh.sh`.
+
+```zsh
+if (( ! ${fpath[(I)/usr/local/share/zsh/site-functions]} )); then
+ FPATH=/usr/local/share/zsh/site-functions:$FPATH
+fi
+```
diff --git a/plugins/github/_github b/plugins/github/_github
deleted file mode 100644
index 83e1713c7..000000000
--- a/plugins/github/_github
+++ /dev/null
@@ -1,40 +0,0 @@
-#compdef github
-#autoload
-
-# in order to make this work, you will need to have the github gem installed
-# http://github.com/defunkt/github-gem
-
-# github zsh completion, based on homebrew completion
-
-local -a _1st_arguments
-_1st_arguments=(
- 'browse:Open this repo in a web browser'
- 'clone:Clone a repo'
- 'config:Automatically set configuration info, or pass args to specify'
- 'create-from-local:Create a new GitHub repository from the current local repository'
- 'create:Create a new empty GitHub repository'
- 'fetch:Fetch from a remote to a local branch'
- 'fetch_all:Fetch all refs from a user'
- 'fork:Forks a GitHub repository'
- 'home:Open this repos master branch in a web browser'
- 'ignore:Ignore a SHA from github network commits'
- 'info:Info about this project'
- 'issues:Project issues tools'
- 'network:Project network tools - sub-commands : web [user], list, fetch, commits'
- 'open:Open the given user/project in a web browser'
- 'pull-request:Generate the text for a pull request'
- 'pull:Pull from a remote'
- 'search:Search GitHub for the given repository name'
- 'track:Track another users repository'
-)
-
-local expl
-local -a pkgs installed_pkgs
-
-_arguments \
- '*:: :->subcmds' && return 0
-
-if (( CURRENT == 1 )); then
- _describe -t commands "github subcommand" _1st_arguments
- return
-fi
diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh
index bd69b1bd5..ca19901fd 100644
--- a/plugins/github/github.plugin.zsh
+++ b/plugins/github/github.plugin.zsh
@@ -1,56 +1,25 @@
-# Setup hub function for git, if it is available; http://github.com/defunkt/hub
-if [ "$commands[(I)hub]" ] && [ "$commands[(I)ruby]" ]; then
- # Autoload _git completion functions
- if declare -f _git > /dev/null; then
- _git
- fi
-
- if declare -f _git_commands > /dev/null; then
- _hub_commands=(
- 'alias:show shell instructions for wrapping git'
- 'pull-request:open a pull request on GitHub'
- 'fork:fork origin repo on GitHub'
- 'create:create new repo on GitHub for the current project'
- 'browse:browse the project on GitHub'
- 'compare:open GitHub compare view'
- )
- # Extend the '_git_commands' function with hub commands
- eval "$(declare -f _git_commands | sed -e 's/base_commands=(/base_commands=(${_hub_commands} /')"
- fi
- # eval `hub alias -s zsh`
- function git(){
- if ! (( $+_has_working_hub )); then
- hub --version &> /dev/null
- _has_working_hub=$(($? == 0))
- fi
- if (( $_has_working_hub )) ; then
- hub "$@"
- else
- command git "$@"
- fi
- }
+# Set up hub wrapper for git, if it is available; http://github.com/github/hub
+if [ "$commands[(I)hub]" ]; then
+ if hub --version &>/dev/null; then
+ eval $(hub alias -s zsh)
+ fi
fi
# Functions #################################################################
-# https://github.com/dbb
+# Based on https://github.com/dbb/githome/blob/master/.config/zsh/functions
-
-# empty_gh [NAME_OF_REPO]
+# empty_gh <NAME_OF_REPO>
#
# Use this when creating a new repo from scratch.
+# Creates a new repo with a blank README.md in it and pushes it up to GitHub.
empty_gh() { # [NAME_OF_REPO]
- repo=$1
- ghuser=$( git config github.user )
+ emulate -L zsh
+ local repo=$1
- mkdir "$repo"
- cd "$repo"
- git init
- touch README
- git add README
- git commit -m 'Initial commit.'
- git remote add origin git@github.com:${ghuser}/${repo}.git
- git push -u origin master
+ mkdir "$repo"
+ touch "$repo/README.md"
+ new_gh "$repo"
}
# new_gh [DIRECTORY]
@@ -58,16 +27,25 @@ empty_gh() { # [NAME_OF_REPO]
# Use this when you have a directory that is not yet set up for git.
# This function will add all non-hidden files to git.
new_gh() { # [DIRECTORY]
- cd "$1"
- ghuser=$( git config github.user )
+ emulate -L zsh
+ local repo="$1"
+ cd "$repo" \
+ || return
- git init
- # add all non-dot files
- print '.*'"\n"'*~' >> .gitignore
- git add ^.*
- git commit -m 'Initial commit.'
- git remote add origin git@github.com:${ghuser}/${repo}.git
- git push -u origin master
+ git init \
+ || return
+ # add all non-dot files
+ print '.*'"\n"'*~' >> .gitignore
+ git add [^.]* \
+ || return
+ git add .gitignore \
+ || return
+ git commit -m 'Initial commit.' \
+ || return
+ hub create \
+ || return
+ git push -u origin master \
+ || return
}
# exist_gh [DIRECTORY]
@@ -75,13 +53,13 @@ new_gh() { # [DIRECTORY]
# Use this when you have a git repo that's ready to go and you want to add it
# to your GitHub.
exist_gh() { # [DIRECTORY]
- cd "$1"
- name=$( git config user.name )
- ghuser=$( git config github.user )
- repo=$1
+ emulate -L zsh
+ local repo=$1
+ cd "$repo"
- git remote add origin git@github.com:${ghuser}/${repo}.git
- git push -u origin master
+ hub create \
+ || return
+ git push -u origin master
}
# git.io "GitHub URL"
@@ -91,7 +69,10 @@ exist_gh() { # [DIRECTORY]
# source: https://github.com/nvogel/dotzsh
# documentation: https://github.com/blog/985-git-io-github-url-shortener
#
-git.io() {curl -i -s http://git.io -F "url=$1" | grep "Location" | cut -f 2 -d " "}
+git.io() {
+ emulate -L zsh
+ curl -i -s http://git.io -F "url=$1" | grep "Location" | cut -f 2 -d " "
+}
# End Functions #############################################################
diff --git a/plugins/gradle/gradle.plugin.zsh b/plugins/gradle/gradle.plugin.zsh
index 661c29d5b..a908eaeaa 100644
--- a/plugins/gradle/gradle.plugin.zsh
+++ b/plugins/gradle/gradle.plugin.zsh
@@ -1,4 +1,3 @@
-#!zsh
##############################################################################
# A descriptive listing of core Gradle commands
############################################################################
@@ -54,22 +53,11 @@ function _gradle_arguments() {
##############################################################################
-# Are we in a directory containing a build.gradle file?
-############################################################################
-function in_gradle() {
- if [[ -f build.gradle ]]; then
- echo 1
- fi
-}
-
-############################################################################## Examine the build.gradle file to see if its
-# timestamp has changed, and if so, regen
-# the .gradle_tasks cache file
+# Examine the build.gradle file to see if its timestamp has changed;
+# and if so, regenerate the .gradle_tasks cache file
############################################################################
_gradle_does_task_list_need_generating () {
- [ ! -f .gradletasknamecache ] && return 0;
- [ build.gradle -nt .gradletasknamecache ] && return 0;
- return 1;
+ [[ ! -f .gradletasknamecache ]] || [[ build.gradle -nt .gradletasknamecache ]]
}
@@ -77,22 +65,22 @@ _gradle_does_task_list_need_generating () {
# Discover the gradle tasks by running "gradle tasks --all"
############################################################################
_gradle_tasks () {
- if [ in_gradle ]; then
+ if [[ -f build.gradle ]]; then
_gradle_arguments
if _gradle_does_task_list_need_generating; then
- gradle tasks --all | grep "^[ ]*[a-zA-Z0-9:]*\ -\ " | sed "s/ - .*$//" | sed "s/[\ ]*//" > .gradletasknamecache
+ gradle tasks --all | awk '/[a-zA-Z0-9:-]* - / {print $1}' > .gradletasknamecache
fi
- compadd -X "==== Gradle Tasks ====" `cat .gradletasknamecache`
+ compadd -X "==== Gradle Tasks ====" $(cat .gradletasknamecache)
fi
}
_gradlew_tasks () {
- if [ in_gradle ]; then
+ if [[ -f build.gradle ]]; then
_gradle_arguments
if _gradle_does_task_list_need_generating; then
- ./gradlew tasks --all | grep "^[ ]*[a-zA-Z0-9:]*\ -\ " | sed "s/ - .*$//" | sed "s/[\ ]*//" > .gradletasknamecache
+ ./gradlew tasks --all | awk '/[a-zA-Z0-9:-]* - / {print $1}' > .gradletasknamecache
fi
- compadd -X "==== Gradlew Tasks ====" `cat .gradletasknamecache`
+ compadd -X "==== Gradlew Tasks ====" $(cat .gradletasknamecache)
fi
}
@@ -102,13 +90,3 @@ _gradlew_tasks () {
############################################################################
compdef _gradle_tasks gradle
compdef _gradlew_tasks gradlew
-
-
-##############################################################################
-# Open questions for future improvements:
-# 1) Should 'gradle tasks' use --all or just the regular set?
-# 2) Should gradlew use the same approach as gradle?
-# 3) Should only the " - " be replaced with a colon so it can work
-# with the richer descriptive method of _arguments?
-# gradle tasks | grep "^[a-zA-Z0-9]*\ -\ " | sed "s/ - /\:/"
-#############################################################################
diff --git a/plugins/mercurial/README.md b/plugins/mercurial/README.md
index 89e1c1743..f42212d68 100644
--- a/plugins/mercurial/README.md
+++ b/plugins/mercurial/README.md
@@ -2,23 +2,20 @@
### Usage
Update .zshrc:
-1. Add name to the list of plugins, e.g. `plugins = (..., mercurial, ...)`
+1. Add name to the list of plugins, e.g. `plugins=(... mercurial ...)`
(that is pretty obvious).
-2. Change PROMPT variable of current theme to contain current folder mercurial repo info:
+2. Switch to a theme which uses `hg_prompt_info`.
- robbyrussel theme is used by default, so you need to modify PROMPT var
- from [this file](https://github.com/robbyrussell/oh-my-zsh/blob/master/themes/robbyrussell.zsh-theme)
- by adding `$(hg_prompt_info)` after `$(git_prompt_info)`, so currently it
- looks next:
+ Or, customize the `$PROMPT` variable of your current theme to contain current folder mercurial repo info. This can be done by putting a custom version of the theme in `$ZSH_CUSTOM` or by changing `$PROMPT` in `.zshrc` after loading the theme.
- ```diff
- - PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
- + PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)$(hg_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
+ The `robbyrussell` theme is used by default, so you need to modify `$PROMPT` var by adding `$(hg_prompt_info)` after `$(git_prompt_info)`, so it looks like this:
+
+ ```zsh
+ PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)$(hg_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
```
-
- and put modified var at the end of **.zshrc**.
+
3. Initialize additional vars used in plugin. So in short put next in **.zshrc**:
-
+
```
ZSH_THEME_HG_PROMPT_PREFIX="%{$fg_bold[magenta]%}hg:(%{$fg[red]%}"
ZSH_THEME_HG_PROMPT_SUFFIX="%{$reset_color%}"
@@ -55,8 +52,7 @@ Update .zshrc:
#### Displays repo branch and directory status in prompt
This is the same as git plugin does.
-**Note**: additional changes to **.zshrc** are required in order for this to
-work.
+**Note**: Additional changes to **.zshrc**, or using a theme designed to use `hg_prompt_info`, are required in order for this to work.
### Mantainers
[ptrv](https://github.com/ptrv) - original creator
diff --git a/plugins/wp-cli/README.md b/plugins/wp-cli/README.md
index 6dda07d17..1a79d60fc 100644
--- a/plugins/wp-cli/README.md
+++ b/plugins/wp-cli/README.md
@@ -43,7 +43,7 @@ WP-CLI is a set of command-line tools for managing WordPress installations. You
- wpps='search'
- wppst='status'
- wppt='toggle'
-- wppu='uninstall'
+- wppun='uninstall'
- wppu='update'
### Post
@@ -55,7 +55,7 @@ WP-CLI is a set of command-line tools for managing WordPress installations. You
- wppol='wp post list'
- wppom='wp post meta'
- wppou='wp post update'
-- wppou='wp post url'
+- wppourl='wp post url'
### Sidebar
- wpsbl='wp sidebar list'
diff --git a/plugins/wp-cli/wp-cli.plugin.zsh b/plugins/wp-cli/wp-cli.plugin.zsh
index 6c70a7a09..7b41c3257 100644
--- a/plugins/wp-cli/wp-cli.plugin.zsh
+++ b/plugins/wp-cli/wp-cli.plugin.zsh
@@ -63,7 +63,7 @@ alias wppp='wp plugin path'
alias wpps='wp plugin search'
alias wppst='wp plugin status'
alias wppt='wp plugin toggle'
-alias wppu='wp plugin uninstall'
+alias wppun='wp plugin uninstall'
alias wppu='wp plugin update'
# Post
@@ -75,7 +75,7 @@ alias wppog='wp post get'
alias wppol='wp post list'
alias wppom='wp post meta'
alias wppou='wp post update'
-alias wppou='wp post url'
+alias wppourl='wp post url'
# Rewrite