summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/brew.plugin.zsh67
-rw-r--r--plugins/git.plugin.zsh32
-rw-r--r--plugins/lighthouse.plugin.zsh16
-rw-r--r--plugins/mysql-macports.plugin.zsh6
-rw-r--r--plugins/osx.plugin.zsh11
-rw-r--r--plugins/rails.plugin.zsh36
-rw-r--r--plugins/ruby.plugin.zsh4
-rw-r--r--plugins/textmate.plugin.zsh14
-rw-r--r--plugins/vi-mode.plugin.zsh22
9 files changed, 208 insertions, 0 deletions
diff --git a/plugins/brew.plugin.zsh b/plugins/brew.plugin.zsh
new file mode 100644
index 000000000..162eb6442
--- /dev/null
+++ b/plugins/brew.plugin.zsh
@@ -0,0 +1,67 @@
+#compdef brew
+
+# imported from the latest homebrew contributions
+
+_brew_all_formulae() {
+ formulae=(`brew search`)
+}
+
+_brew_installed_formulae() {
+ installed_formulae=(`brew list`)
+}
+
+local -a _1st_arguments
+_1st_arguments=(
+ 'cat:display formula file for a formula'
+ 'cleanup:uninstall unused and old versions of packages'
+ 'create:create a new formula'
+ 'deps:list dependencies and dependants of a formula'
+ 'doctor:audits your installation for common issues'
+ 'edit:edit a formula'
+ 'home:visit the homepage of a formula or the brew project'
+ 'info:information about a formula'
+ 'install:install a formula'
+ 'link:link a formula'
+ 'list:list files in a formula or not-installed formulae'
+ 'log:git commit log for a formula'
+ 'outdated:list formulas for which a newer version is available'
+ 'prune:remove dead links'
+ 'remove:remove a formula'
+ 'search:search for a formula (/regex/ or string)'
+ 'unlink:unlink a formula'
+ 'update:freshen up links'
+ 'uses:show formulas which depend on 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|uses|cat|deps)
+ _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..655eaf728
--- /dev/null
+++ b/plugins/git.plugin.zsh
@@ -0,0 +1,32 @@
+# 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)'
+alias ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)' \ No newline at end of file
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/mysql-macports.plugin.zsh b/plugins/mysql-macports.plugin.zsh
new file mode 100644
index 000000000..63b881c9f
--- /dev/null
+++ b/plugins/mysql-macports.plugin.zsh
@@ -0,0 +1,6 @@
+# commands to control local mysql-server installation
+# paths are for osx installtion via macports
+
+alias mysqlstart='sudo /opt/local/bin/mysqld_safe5'
+alias mysqlstop='/opt/local/bin/mysqladmin5 -u root -p shutdown'
+alias mysqlstatus='mysqladmin5 -u root -p ping' \ 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
+}
diff --git a/plugins/vi-mode.plugin.zsh b/plugins/vi-mode.plugin.zsh
new file mode 100644
index 000000000..c47ab7211
--- /dev/null
+++ b/plugins/vi-mode.plugin.zsh
@@ -0,0 +1,22 @@
+function zle-line-init zle-keymap-select {
+ zle reset-prompt
+}
+
+zle -N zle-line-init
+zle -N zle-keymap-select
+
+bindkey -v
+
+# if mode indicator wasn't setup by theme, define default
+if [[ "$MODE_INDICATOR" == "" ]]; then
+ MODE_INDICATOR="%{$fg_bold[red]%}<%{$fg[red]%}<<%{$reset_color%}"
+fi
+
+function vi_mode_prompt_info() {
+ echo "${${KEYMAP/vicmd/$MODE_INDICATOR}/(main|viins)/}"
+}
+
+# define right prompt, if it wasn't defined by a theme
+if [[ "$RPS1" == "" && "$RPROMPT" == "" ]]; then
+ RPS1='$(vi_mode_prompt_info)'
+fi