diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/brew.plugin.zsh | 61 | ||||
-rw-r--r-- | plugins/git.plugin.zsh | 31 | ||||
-rw-r--r-- | plugins/lighthouse.plugin.zsh | 16 | ||||
-rw-r--r-- | plugins/osx.plugin.zsh | 11 | ||||
-rw-r--r-- | plugins/rails.plugin.zsh | 36 | ||||
-rw-r--r-- | plugins/ruby.plugin.zsh | 4 | ||||
-rw-r--r-- | plugins/textmate.plugin.zsh | 14 |
7 files changed, 173 insertions, 0 deletions
diff --git a/plugins/brew.plugin.zsh b/plugins/brew.plugin.zsh new file mode 100644 index 000000000..91397bf3a --- /dev/null +++ b/plugins/brew.plugin.zsh @@ -0,0 +1,61 @@ +#compdef brew + +# copied from _fink + +_brew_all_formulae() { + formulae=(`brew search`) +} + +_brew_installed_formulae() { + installed_formulae=(`brew list`) +} + +local -a _1st_arguments +_1st_arguments=( + 'install:install a formula' + 'remove:remove a formula' + 'search:search for a formula (/regex/ or string)' + 'list:list files in a formula or not-installed formulae' + 'link:link a formula' + 'unlink:unlink a formula' + 'home:visit the homepage of a formula or the brew project' + 'info:information about a formula' + 'prune:remove dead links' + 'update:freshen up links' + 'log:git commit log for a formula' + 'create:create a new formula' + 'edit:edit a formula' +) + +local expl +local -a formula installed_formulae + +_arguments \ + '(-v --verbose)'{-v,--verbose}'[verbose]' \ + '(--version)--version[version information]' \ + '(--prefix)--prefix[where brew lives on this system]' \ + '(--cache)--cache[brew cache]' \ + '*:: :->subcmds' && return 0 + +if (( CURRENT == 1 )); then + _describe -t commands "brew subcommand" _1st_arguments + return +fi + +case "$words[1]" in + list) + _arguments \ + '(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \ + '1: :->forms' && return 0 + + if [[ "$state" == forms ]]; then + _brew_installed_formulae + _requested installed_formulae expl 'installed formulae' compadd -a installed_formulae + fi ;; + install|home|log|info) + _brew_all_formulae + _wanted formulae expl 'all formulae' compadd -a formulae ;; + remove|edit|xo) + _brew_installed_formulae + _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;; +esac diff --git a/plugins/git.plugin.zsh b/plugins/git.plugin.zsh new file mode 100644 index 000000000..e0d967056 --- /dev/null +++ b/plugins/git.plugin.zsh @@ -0,0 +1,31 @@ +# Aliases +alias g='git' +alias gst='git status' +alias gl='git pull' +alias gup='git fetch && git rebase' +alias gp='git push' +alias gd='git diff | mate' +alias gdv='git diff -w "$@" | vim -R -' +alias gc='git commit -v' +alias gca='git commit -v -a' +alias gb='git branch' +alias gba='git branch -a' +alias gcount='git shortlog -sn' +alias gcp='git cherry-pick' + + +# Git and svn mix +alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' + +# +# Will return the current branch name +# Usage example: git pull origin $(current_branch) +# +function current_branch() { + ref=$(git symbolic-ref HEAD 2> /dev/null) || return + echo ${ref#refs/heads/} +} + +# these aliases take advangate of the previous function +alias ggpull='git pull origin $(current_branch)' +alias ggpush='git push origin $(current_branch)' diff --git a/plugins/lighthouse.plugin.zsh b/plugins/lighthouse.plugin.zsh new file mode 100644 index 000000000..4eb06a997 --- /dev/null +++ b/plugins/lighthouse.plugin.zsh @@ -0,0 +1,16 @@ +# To use: add a .lighthouse file into your directory with the URL to the +# individual project. For example: +# https://rails.lighthouseapp.com/projects/8994 +# Example usage: http://screencast.com/t/ZDgwNDUwNT +open_lighthouse_ticket () { + if [ ! -f .lighthouse-url ]; then + echo "There is no .lighthouse file in the current directory..." + return 0; + else + lighthouse_url=$(cat .lighthouse-url); + echo "Opening ticket #$1"; + `open $lighthouse_url/tickets/$1`; + fi +} + +alias lho='open_lighthouse_ticket'
\ No newline at end of file diff --git a/plugins/osx.plugin.zsh b/plugins/osx.plugin.zsh new file mode 100644 index 000000000..fce88c796 --- /dev/null +++ b/plugins/osx.plugin.zsh @@ -0,0 +1,11 @@ +function tab() { + osascript 2>/dev/null <<EOF + tell application "System Events" + tell process "Terminal" to keystroke "t" using command down + end + tell application "Terminal" + activate + do script with command "cd \"$PWD\"; $*" in window 1 + end tell +EOF +}
\ No newline at end of file diff --git a/plugins/rails.plugin.zsh b/plugins/rails.plugin.zsh new file mode 100644 index 000000000..45bebb722 --- /dev/null +++ b/plugins/rails.plugin.zsh @@ -0,0 +1,36 @@ + +alias ss='thin --stats "/thin/stats" start' +alias sg='ruby script/generate' +alias sd='ruby script/destroy' +alias sp='ruby script/plugin' +alias ssp='ruby script/spec' +alias rdbm='rake db:migrate' +alias sc='ruby script/console' +alias sd='ruby script/server --debugger' +alias devlog='tail -f log/development.log' + +function _cap_does_task_list_need_generating () { + if [ ! -f .cap_tasks~ ]; then return 0; + else + accurate=$(stat -f%m .cap_tasks~) + changed=$(stat -f%m config/deploy.rb) + return $(expr $accurate '>=' $changed) + fi +} + +function _cap () { + if [ -f config/deploy.rb ]; then + if _cap_does_task_list_need_generating; then + echo "\nGenerating .cap_tasks~..." > /dev/stderr + cap show_tasks -q | cut -d " " -f 1 | sed -e '/^ *$/D' -e '1,2D' +> .cap_tasks~ + fi + compadd `cat .cap_tasks~` + fi +} + +compctl -K _cap cap + +function remote_console() { + /usr/bin/env ssh $1 "( cd $2 && ruby script/console production )" +} diff --git a/plugins/ruby.plugin.zsh b/plugins/ruby.plugin.zsh new file mode 100644 index 000000000..82bf5d49d --- /dev/null +++ b/plugins/ruby.plugin.zsh @@ -0,0 +1,4 @@ +alias sgem='sudo gem' + +# Find ruby file +alias rfind='find . -name *.rb | xargs grep -n'
\ No newline at end of file diff --git a/plugins/textmate.plugin.zsh b/plugins/textmate.plugin.zsh new file mode 100644 index 000000000..7b73e2751 --- /dev/null +++ b/plugins/textmate.plugin.zsh @@ -0,0 +1,14 @@ + +# 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 +alias mr='mate CHANGELOG app config db lib public script spec test' + +function tm() { + cd $1 + mate $1 +} |