summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/git.zsh2
-rw-r--r--plugins/bundler/bundler.plugin.zsh2
-rw-r--r--plugins/github/github.plugin.zsh17
-rw-r--r--plugins/knife/_knife17
-rw-r--r--plugins/last-working-dir/last-working-dir.plugin.zsh3
-rw-r--r--plugins/safe-paste/safe-paste.plugin.zsh54
-rwxr-xr-xplugins/sublime/sublime.plugin.zsh2
-rw-r--r--plugins/symfony2/symfony2.plugin.zsh6
-rw-r--r--plugins/zeus/zeus.plugin.zsh6
-rw-r--r--themes/gianu.zsh-theme11
10 files changed, 103 insertions, 17 deletions
diff --git a/lib/git.zsh b/lib/git.zsh
index 67075248e..98c00bd8a 100644
--- a/lib/git.zsh
+++ b/lib/git.zsh
@@ -62,7 +62,7 @@ function git_prompt_long_sha() {
git_prompt_status() {
INDEX=$(git status --porcelain -b 2> /dev/null)
STATUS=""
- if $(echo "$INDEX" | grep '^\?\? ' &> /dev/null); then
+ if $(echo "$INDEX" | grep -E '^\?\? ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS"
fi
if $(echo "$INDEX" | grep '^A ' &> /dev/null); then
diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh
index 10c221acd..bc21da134 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 zeus)
+bundled_commands=(annotate cap capify cucumber foreman guard middleman nanoc rackup rainbows rake rspec ruby shotgun spec spork thin thor unicorn unicorn_rails puma)
## Functions
diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh
index 598b059c1..66a10cfdb 100644
--- a/plugins/github/github.plugin.zsh
+++ b/plugins/github/github.plugin.zsh
@@ -1,5 +1,22 @@
# 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
diff --git a/plugins/knife/_knife b/plugins/knife/_knife
index dec491257..9f5b406af 100644
--- a/plugins/knife/_knife
+++ b/plugins/knife/_knife
@@ -1,5 +1,10 @@
#compdef knife
+# You can override the path to knife.rb and your cookbooks by setting
+# KNIFE_CONF_PATH=/path/to/my/.chef/knife.rb
+# KNIFE_COOKBOOK_PATH=/path/to/my/chef/cookbooks
+# Read around where these are used for more detail.
+
# These flags should be available everywhere according to man knife
knife_general_flags=( --help --server-url --key --config --editor --format --log_level --logfile --no-editor --user --print-after --version --yes )
@@ -170,11 +175,13 @@ _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() {
- 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)
+
+ local knife_rb=${KNIFE_CONF_PATH:-${HOME}/.chef/knife.rb}
+ if [ -f ./.chef/knife.rb ]; then
+ knife_rb="./.chef/knife.rb"
+ fi
+ local cookbook_path=${KNIFE_COOKBOOK_PATH:-$(grep cookbook_path $knife_rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' )}
+ (for i in $cookbook_path; 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 190bc279d..ccf0f5b22 100644
--- a/plugins/last-working-dir/last-working-dir.plugin.zsh
+++ b/plugins/last-working-dir/last-working-dir.plugin.zsh
@@ -9,7 +9,8 @@ local cache_file="$ZSH/cache/last-working-dir"
# Updates the last directory once directory is changed.
function chpwd() {
- echo "$PWD" > "$cache_file"
+ # Use >! in case noclobber is set to avoid "file exists" error
+ echo "$PWD" >! "$cache_file"
}
# Changes directory to the last working directory.
diff --git a/plugins/safe-paste/safe-paste.plugin.zsh b/plugins/safe-paste/safe-paste.plugin.zsh
new file mode 100644
index 000000000..0aa97965f
--- /dev/null
+++ b/plugins/safe-paste/safe-paste.plugin.zsh
@@ -0,0 +1,54 @@
+# Code from Mikael Magnusson: http://www.zsh.org/mla/users/2011/msg00367.html
+#
+# Requires xterm, urxvt, iTerm2 or any other terminal that supports bracketed
+# paste mode as documented: http://www.xfree86.org/current/ctlseqs.html
+
+# create a new keymap to use while pasting
+bindkey -N paste
+# make everything in this keymap call our custom widget
+bindkey -R -M paste "^@"-"\M-^?" paste-insert
+# these are the codes sent around the pasted text in bracketed
+# paste mode.
+# do the first one with both -M viins and -M vicmd in vi mode
+bindkey '^[[200~' _start_paste
+bindkey -M paste '^[[201~' _end_paste
+# insert newlines rather than carriage returns when pasting newlines
+bindkey -M paste -s '^M' '^J'
+
+zle -N _start_paste
+zle -N _end_paste
+zle -N zle-line-init _zle_line_init
+zle -N zle-line-finish _zle_line_finish
+zle -N paste-insert _paste_insert
+
+# switch the active keymap to paste mode
+function _start_paste() {
+ bindkey -A paste main
+}
+
+# go back to our normal keymap, and insert all the pasted text in the
+# command line. this has the nice effect of making the whole paste be
+# a single undo/redo event.
+function _end_paste() {
+#use bindkey -v here with vi mode probably. maybe you want to track
+#if you were in ins or cmd mode and restore the right one.
+ bindkey -e
+ LBUFFER+=$_paste_content
+ unset _paste_content
+}
+
+function _paste_insert() {
+ _paste_content+=$KEYS
+}
+
+function _zle_line_init() {
+ # Tell terminal to send escape codes around pastes.
+ [[ $TERM == rxvt-unicode || $TERM == xterm || $TERM = xterm-256color ]] && printf '\e[?2004h'
+}
+
+function _zle_line_finish() {
+ # Tell it to stop when we leave zle, so pasting in other programs
+ # doesn't get the ^[[200~ codes around the pasted text.
+ [[ $TERM == rxvt-unicode || $TERM == xterm || $TERM = xterm-256color ]] && printf '\e[?2004l'
+}
+
diff --git a/plugins/sublime/sublime.plugin.zsh b/plugins/sublime/sublime.plugin.zsh
index bfbc45a07..7a5ada337 100755
--- a/plugins/sublime/sublime.plugin.zsh
+++ b/plugins/sublime/sublime.plugin.zsh
@@ -1,6 +1,6 @@
# Sublime Text 2 Aliases
-local _sublime_darwin_paths
+local _sublime_darwin_paths > /dev/null 2>&1
_sublime_darwin_paths=(
"$HOME/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
"$HOME/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl"
diff --git a/plugins/symfony2/symfony2.plugin.zsh b/plugins/symfony2/symfony2.plugin.zsh
index cc9ffebc0..45d6165aa 100644
--- a/plugins/symfony2/symfony2.plugin.zsh
+++ b/plugins/symfony2/symfony2.plugin.zsh
@@ -14,6 +14,8 @@ compdef _symfony2 app/console
compdef _symfony2 sf
#Alias
-alias sf2='php app/console'
-alias sf2clear='php app/console cache:clear'
+alias sf='php app/console'
+alias sfcl='php app/console cache:clear'
+alias sfroute='php app/console router:debug'
+alias sfgb='php app/console generate:bundle'
diff --git a/plugins/zeus/zeus.plugin.zsh b/plugins/zeus/zeus.plugin.zsh
index 1658b34d3..eddfb4f94 100644
--- a/plugins/zeus/zeus.plugin.zsh
+++ b/plugins/zeus/zeus.plugin.zsh
@@ -2,12 +2,6 @@
# Zeus preloads your Rails environment and forks that process whenever
# needed. This effectively speeds up Rails' boot process to under 1 sec.
-# Always use bundler.
-# Rails depends on bundler, so we can be pretty sure, that there are no
-# problems with this command. For all the other aliases I provided an
-# alternative, in case people have conflicts with other plugins (e.g. suse).
-alias zeus='bundle exec zeus'
-
# Init
alias zi='zeus init'
alias zinit='zeus init'
diff --git a/themes/gianu.zsh-theme b/themes/gianu.zsh-theme
new file mode 100644
index 000000000..c7fe40665
--- /dev/null
+++ b/themes/gianu.zsh-theme
@@ -0,0 +1,11 @@
+# Oh-my-Zsh prompt created by gianu
+#
+# github.com/gianu
+# sgianazza@gmail.com
+
+PROMPT='[%{$fg_bold[white]%}%n%{$reset_color%}@%{$fg_bold[red]%}%m%{$reset_color%} %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)%{$reset_color%}]$ '
+
+ZSH_THEME_GIT_PROMPT_PREFIX="(%{$fg_bold[green]%}"
+ZSH_THEME_GIT_PROMPT_SUFFIX=")"
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%} %{$fg[yellow]%}✗%{$reset_color%}"
+ZSH_THEME_GIT_PROMPT_CLEAN="%{$reset_color%}"