summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/autoenv/autoenv.plugin.zsh28
-rw-r--r--plugins/coffee/coffee.plugin.zsh10
-rw-r--r--plugins/colored-man-pages/colored-man-pages.plugin.zsh (renamed from plugins/colored-man/colored-man.plugin.zsh)0
-rw-r--r--plugins/copydir/copydir.plugin.zsh6
-rw-r--r--plugins/copyfile/copyfile.plugin.zsh8
-rw-r--r--plugins/encode64/encode64.plugin.zsh4
-rw-r--r--plugins/git-extras/README.md11
-rw-r--r--plugins/git-extras/git-extras.plugin.zsh82
-rw-r--r--plugins/git/git.plugin.zsh2
-rw-r--r--plugins/rails/rails.plugin.zsh1
-rw-r--r--plugins/systemd/systemd.plugin.zsh4
-rw-r--r--plugins/textmate/textmate.plugin.zsh8
12 files changed, 98 insertions, 66 deletions
diff --git a/plugins/autoenv/autoenv.plugin.zsh b/plugins/autoenv/autoenv.plugin.zsh
index a8271849e..ea2e56dd6 100644
--- a/plugins/autoenv/autoenv.plugin.zsh
+++ b/plugins/autoenv/autoenv.plugin.zsh
@@ -1,12 +1,26 @@
# Activates autoenv or reports its failure
-if ! source $HOME/.autoenv/activate.sh 2>/dev/null; then
- echo '-------- AUTOENV ---------'
- echo 'Could not find ~/.autoenv/activate.sh.'
- echo 'Please check if autoenv is correctly installed.'
- echo 'In the meantime the autoenv plugin is DISABLED.'
- echo '--------------------------'
- return 1
+() {
+if ! type autoenv_init >/dev/null; then
+ for d (~/.autoenv /usr/local/opt/autoenv); do
+ if [[ -e $d/activate.sh ]]; then
+ autoenv_dir=$d
+ break
+ fi
+ done
+ if [[ -z $autoenv_dir ]]; then
+ cat <<END >&2
+-------- AUTOENV ---------
+Could not locate autoenv installation.
+Please check if autoenv is correctly installed.
+In the meantime the autoenv plugin is DISABLED.
+--------------------------
+END
+ return 1
+ fi
+ source $autoenv_dir/activate.sh
fi
+}
+[[ $? != 0 ]] && return $?
# The use_env call below is a reusable command to activate/create a new Python
# virtualenv, requiring only a single declarative line of code in your .env files.
diff --git a/plugins/coffee/coffee.plugin.zsh b/plugins/coffee/coffee.plugin.zsh
index 4e98e0228..77cb663f7 100644
--- a/plugins/coffee/coffee.plugin.zsh
+++ b/plugins/coffee/coffee.plugin.zsh
@@ -6,11 +6,11 @@ cf () {
}
# compile & copy to clipboard
cfc () {
- cf "$1" | pbcopy
+ cf "$1" | clipcopy
}
-# compile from pasteboard & print
-alias cfp='coffeeMe "$(pbpaste)"'
+# compile from clipboard & print
+alias cfp='coffeeMe "$(clippaste)"'
-# compile from pasteboard and copy to clipboard
-alias cfpc='cfp | pbcopy'
+# compile from clipboard and copy to clipboard
+alias cfpc='cfp | clipcopy'
diff --git a/plugins/colored-man/colored-man.plugin.zsh b/plugins/colored-man-pages/colored-man-pages.plugin.zsh
index 5c613f49d..5c613f49d 100644
--- a/plugins/colored-man/colored-man.plugin.zsh
+++ b/plugins/colored-man-pages/colored-man-pages.plugin.zsh
diff --git a/plugins/copydir/copydir.plugin.zsh b/plugins/copydir/copydir.plugin.zsh
index 37bb5e086..c45106240 100644
--- a/plugins/copydir/copydir.plugin.zsh
+++ b/plugins/copydir/copydir.plugin.zsh
@@ -1,3 +1,5 @@
+# Copies the pathname of the current directory to the system or X Windows clipboard
function copydir {
- pwd | tr -d "\r\n" | pbcopy
-} \ No newline at end of file
+ emulate -L zsh
+ print -n $PWD | clipcopy
+}
diff --git a/plugins/copyfile/copyfile.plugin.zsh b/plugins/copyfile/copyfile.plugin.zsh
index 944a903c6..f4eca5acf 100644
--- a/plugins/copyfile/copyfile.plugin.zsh
+++ b/plugins/copyfile/copyfile.plugin.zsh
@@ -1,5 +1,7 @@
+# Copies the contents of a given file to the system or X Windows clipboard
+#
+# copyfile <file>
function copyfile {
- [[ "$#" != 1 ]] && return 1
- local file_to_copy=$1
- cat $file_to_copy | pbcopy
+ emulate -L zsh
+ clipcopy $1
}
diff --git a/plugins/encode64/encode64.plugin.zsh b/plugins/encode64/encode64.plugin.zsh
index 4dbd1b453..53de6478a 100644
--- a/plugins/encode64/encode64.plugin.zsh
+++ b/plugins/encode64/encode64.plugin.zsh
@@ -1,4 +1,4 @@
-encode64(){ echo -n $1 | base64 }
-decode64(){ echo -n $1 | base64 --decode }
+encode64(){ printf '%s' $1 | base64 }
+decode64(){ printf '%s' $1 | base64 --decode }
alias e64=encode64
alias d64=decode64
diff --git a/plugins/git-extras/README.md b/plugins/git-extras/README.md
new file mode 100644
index 000000000..8f12e297e
--- /dev/null
+++ b/plugins/git-extras/README.md
@@ -0,0 +1,11 @@
+# git-extras
+
+This plugin provides completion definitions for some of the commands defined by [git-extras](http://github.com/tj/git-extras).
+
+## Setup notes
+
+The completions work by augmenting the `_git` completion provided by `zsh`. This only works with the `zsh`-provided `_git`, not the `_git` provided by `git` itself. If you have both `zsh` and `git` installed, you need to make sure that the `zsh`-provided `_git` takes precedence.
+
+### OS X Homebrew Setup
+
+On OS X with Homebrew, you need to install `git` with `brew install git --without-completions`. Otherwise, `git`'s `_git` will take precedence, and you won't see the completions for `git-extras` commands.
diff --git a/plugins/git-extras/git-extras.plugin.zsh b/plugins/git-extras/git-extras.plugin.zsh
index d91c1af81..681fbb466 100644
--- a/plugins/git-extras/git-extras.plugin.zsh
+++ b/plugins/git-extras/git-extras.plugin.zsh
@@ -1,10 +1,13 @@
-#compdef git
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for git-extras (http://github.com/tj/git-extras).
#
+# This depends on and reueses some of the internals of the _git completion
+# function that ships with zsh itself. It will not work with the _git that ships
+# with git.
+#
# ------------------------------------------------------------------------------
# Authors
# -------
@@ -22,16 +25,18 @@
# ------------------------------------------------------------------------------
-__git_command_successful () {
- if (( ${#pipestatus:#0} > 0 )); then
- _message 'not a git repository'
- return 1
- fi
- return 0
-}
+# Internal functions
+# These are a lot like their __git_* equivalents inside _git
+__gitex_command_successful () {
+ if (( ${#*:#0} > 0 )); then
+ _message 'not a git repository'
+ return 1
+ fi
+ return 0
+}
-__git_commits() {
+__gitex_commits() {
declare -A commits
git log --oneline -15 | sed 's/\([[:alnum:]]\{7\}\) /\1:/' | while read commit
do
@@ -42,7 +47,7 @@ __git_commits() {
_describe -t commits commit commits && ret=0
}
-__git_tag_names() {
+__gitex_tag_names() {
local expl
declare -a tag_names
tag_names=(${${(f)"$(_call_program tags git for-each-ref --format='"%(refname)"' refs/tags 2>/dev/null)"}#refs/tags/})
@@ -51,7 +56,7 @@ __git_tag_names() {
}
-__git_branch_names() {
+__gitex_branch_names() {
local expl
declare -a branch_names
branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/})
@@ -59,7 +64,7 @@ __git_branch_names() {
_wanted branch-names expl branch-name compadd $* - $branch_names
}
-__git_specific_branch_names() {
+__gitex_specific_branch_names() {
local expl
declare -a branch_names
branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/"$1" 2>/dev/null)"}#refs/heads/$1/})
@@ -67,32 +72,28 @@ __git_specific_branch_names() {
_wanted branch-names expl branch-name compadd $* - $branch_names
}
-
-__git_feature_branch_names() {
- __git_specific_branch_names 'feature'
+__gitex_feature_branch_names() {
+ __gitex_specific_branch_names 'feature'
}
-
-__git_refactor_branch_names() {
- __git_specific_branch_names 'refactor'
+__gitex_refactor_branch_names() {
+ __gitex_specific_branch_names 'refactor'
}
-
-__git_bug_branch_names() {
- __git_specific_branch_names 'bug'
+__gitex_bug_branch_names() {
+ __gitex_specific_branch_names 'bug'
}
-
-__git_submodule_names() {
+__gitex_submodule_names() {
local expl
declare -a submodule_names
- submodule_names=(${(f)"$(_call_program branchrefs git submodule status | awk '{print $2}')"})
+ submodule_names=(${(f)"$(_call_program branchrefs git submodule status | awk '{print $2}')"}) # '
__git_command_successful || return
_wanted submodule-names expl submodule-name compadd $* - $submodule_names
}
-__git_author_names() {
+__gitex_author_names() {
local expl
declare -a author_names
author_names=(${(f)"$(_call_program branchrefs git log --format='%aN' | sort -u)"})
@@ -123,7 +124,7 @@ _git-bug() {
case $line[1] in
(finish)
_arguments -C \
- ':branch-name:__git_bug_branch_names'
+ ':branch-name:__gitex_bug_branch_names'
;;
esac
esac
@@ -139,7 +140,7 @@ _git-changelog() {
_git-contrib() {
_arguments \
- ':author:__git_author_names'
+ ':author:__gitex_author_names'
}
@@ -151,19 +152,19 @@ _git-count() {
_git-delete-branch() {
_arguments \
- ':branch-name:__git_branch_names'
+ ':branch-name:__gitex_branch_names'
}
_git-delete-submodule() {
_arguments \
- ':submodule-name:__git_submodule_names'
+ ':submodule-name:__gitex_submodule_names'
}
_git-delete-tag() {
_arguments \
- ':tag-name:__git_tag_names'
+ ':tag-name:__gitex_tag_names'
}
@@ -172,6 +173,7 @@ _git-effort() {
'--above[ignore file with less than x commits]'
}
+
_git-extras() {
local curcontext=$curcontext state line ret=1
declare -A opt_args
@@ -216,7 +218,7 @@ _git-feature() {
case $line[1] in
(finish)
_arguments -C \
- ':branch-name:__git_feature_branch_names'
+ ':branch-name:__gitex_feature_branch_names'
;;
esac
esac
@@ -225,8 +227,8 @@ _git-feature() {
_git-graft() {
_arguments \
- ':src-branch-name:__git_branch_names' \
- ':dest-branch-name:__git_branch_names'
+ ':src-branch-name:__gitex_branch_names' \
+ ':dest-branch-name:__gitex_branch_names'
}
@@ -236,12 +238,14 @@ _git-ignore() {
'(--global -g)'{--global,-g}'[show global gitignore]'
}
+
_git-missing() {
_arguments \
- ':first-branch-name:__git_branch_names' \
- ':second-branch-name:__git_branch_names'
+ ':first-branch-name:__gitex_branch_names' \
+ ':second-branch-name:__gitex_branch_names'
}
+
_git-refactor() {
local curcontext=$curcontext state line ret=1
declare -A opt_args
@@ -263,7 +267,7 @@ _git-refactor() {
case $line[1] in
(finish)
_arguments -C \
- ':branch-name:__git_refactor_branch_names'
+ ':branch-name:__gitex_refactor_branch_names'
;;
esac
esac
@@ -272,12 +276,12 @@ _git-refactor() {
_git-squash() {
_arguments \
- ':branch-name:__git_branch_names'
+ ':branch-name:__gitex_branch_names'
}
_git-summary() {
- _arguments '--line[summarize with lines other than commits]'
- __git_commits
+ _arguments '--line[summarize with lines rather than commits]'
+ __gitex_commits
}
diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh
index 4f2745038..d78b82df3 100644
--- a/plugins/git/git.plugin.zsh
+++ b/plugins/git/git.plugin.zsh
@@ -212,11 +212,13 @@ alias gsts='git stash show --text'
alias gsu='git submodule update'
alias gts='git tag -s'
+alias gtv='git tag | sort -V'
alias gunignore='git update-index --no-assume-unchanged'
alias gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1'
alias gup='git pull --rebase'
alias gupv='git pull --rebase -v'
+alias glum='git pull upstream master'
alias gvt='git verify-tag'
diff --git a/plugins/rails/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh
index 1bbd1fb4b..a390c919c 100644
--- a/plugins/rails/rails.plugin.zsh
+++ b/plugins/rails/rails.plugin.zsh
@@ -42,6 +42,7 @@ alias rp='rails plugin'
alias ru='rails runner'
alias rs='rails server'
alias rsd='rails server --debugger'
+alias rsp='rails server --port'
# Rake aliases
alias rdm='rake db:migrate'
diff --git a/plugins/systemd/systemd.plugin.zsh b/plugins/systemd/systemd.plugin.zsh
index 07eb595a6..b19793557 100644
--- a/plugins/systemd/systemd.plugin.zsh
+++ b/plugins/systemd/systemd.plugin.zsh
@@ -10,3 +10,7 @@ sudo_commands=(
for c in $user_commands; do; alias sc-$c="systemctl $c"; done
for c in $sudo_commands; do; alias sc-$c="sudo systemctl $c"; done
+
+alias sc-enable-now="sc-enable --now"
+alias sc-disable-now="sc-disable --now"
+alias sc-mask-now="sc-mask --now"
diff --git a/plugins/textmate/textmate.plugin.zsh b/plugins/textmate/textmate.plugin.zsh
index 773c4f8d2..02813de9e 100644
--- a/plugins/textmate/textmate.plugin.zsh
+++ b/plugins/textmate/textmate.plugin.zsh
@@ -1,11 +1,3 @@
-alias et='mate .'
-alias ett='mate Gemfile app config features 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'
-
-# Edit Ruby app in TextMate
-alias mr='mate CHANGELOG app config db lib public script spec test'
-
# If the tm command is called without an argument, open TextMate in the current directory
# If tm is passed a directory, cd to it and open it in TextMate
# If tm is passed a file, open it in TextMate