diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/atom/atom.plugin.zsh | 18 | ||||
-rw-r--r-- | plugins/common-aliases/common-aliases.plugin.zsh | 2 | ||||
-rw-r--r-- | plugins/dirpersist/dirpersist.plugin.zsh | 50 | ||||
-rw-r--r-- | plugins/knife/_knife | 5 | ||||
-rw-r--r-- | plugins/rake-fast/rake-fast.plugin.zsh | 51 |
5 files changed, 85 insertions, 41 deletions
diff --git a/plugins/atom/atom.plugin.zsh b/plugins/atom/atom.plugin.zsh index 048fd7521..9adb9031a 100644 --- a/plugins/atom/atom.plugin.zsh +++ b/plugins/atom/atom.plugin.zsh @@ -1,4 +1,14 @@ -# -# Your guess is as good as mine. Let's just assume that we will need this... -# - For more info visit... http://atom.io/ -#
\ No newline at end of file +local _atom_paths > /dev/null 2>&1 +_atom_paths=( + "$HOME/Applications/Atom.app" + "/Applications/Atom.app" +) + +for _atom_path in $_atom_paths; do + if [[ -a $_atom_path ]]; then + alias at="open -a '$_atom_path'" + break + fi +done + +alias att='at .' diff --git a/plugins/common-aliases/common-aliases.plugin.zsh b/plugins/common-aliases/common-aliases.plugin.zsh index 75899ca2c..b19650fee 100644 --- a/plugins/common-aliases/common-aliases.plugin.zsh +++ b/plugins/common-aliases/common-aliases.plugin.zsh @@ -71,7 +71,7 @@ if [ ${ZSH_VERSION//\./} -ge 420 ]; then _image_fts=(jpg jpeg png gif mng tiff tif xpm) for ft in $_image_fts ; do alias -s $ft=$XIVIEWER; done - _media_fts=(avi mpg mpeg ogm mp3 wav ogg ape rm mov mkv) + _media_fts=(ape avi flv mkv mov mp3 mpeg mpg ogg ogm rm wav webm) for ft in $_media_fts ; do alias -s $ft=mplayer ; done #read documents diff --git a/plugins/dirpersist/dirpersist.plugin.zsh b/plugins/dirpersist/dirpersist.plugin.zsh index 0f6d9f435..88d1129d4 100644 --- a/plugins/dirpersist/dirpersist.plugin.zsh +++ b/plugins/dirpersist/dirpersist.plugin.zsh @@ -1,39 +1,19 @@ -#!/bin/zsh -# -# Make the dirstack more persistant -# -# Add dirpersist to $plugins in ~/.zshrc to load -# +# Save dirstack history to .zdirs +# adapted from: +# github.com/grml/grml-etc-core/blob/master/etc/zsh/zshrc#L1547 -# $zdirstore is the file used to persist the stack -zdirstore=~/.zdirstore +DIRSTACKSIZE=${DIRSTACKSIZE:-20} +dirstack_file=${dirstack_file:-${HOME}/.zdirs} -dirpersistinstall () { - if grep 'dirpersiststore' ~/.zlogout > /dev/null; then - else - if read -q \?"Would you like to set up your .zlogout file for use with dirspersist? (y/n) "; then - echo "# Store dirs stack\n# See $ZSH/plugins/dirspersist.plugin.zsh\ndirpersiststore" >> ~/.zlogout - else - echo "If you don't want this message to appear, remove dirspersist from \$plugins" - fi - fi -} - -dirpersiststore () { - dirs -p | perl -e 'foreach (reverse <STDIN>) {chomp;s/([& ])/\\$1/g ;print "if [ -d $_ ]; then pushd -q $_; fi\n"}' > $zdirstore -} +if [[ -f ${dirstack_file} ]] && [[ ${#dirstack[*]} -eq 0 ]] ; then + dirstack=( ${(f)"$(< $dirstack_file)"} ) + # "cd -" won't work after login by just setting $OLDPWD, so + [[ -d $dirstack[1] ]] && cd $dirstack[1] && cd $OLDPWD +fi -dirpersistrestore () { - if [ -f $zdirstore ]; then - source $zdirstore - fi +chpwd() { + if (( $DIRSTACKSIZE <= 0 )) || [[ -z $dirstack_file ]]; then return; fi + local -ax my_stack + my_stack=( ${PWD} ${dirstack} ) + builtin print -l ${(u)my_stack} >! ${dirstack_file} } - -DIRSTACKSIZE=10 -setopt autopushd pushdminus pushdsilent pushdtohome pushdignoredups - -dirpersistinstall -dirpersistrestore - -# Make popd changes permanent without having to wait for logout -alias popd="popd;dirpersiststore" diff --git a/plugins/knife/_knife b/plugins/knife/_knife index b44283f78..163149267 100644 --- a/plugins/knife/_knife +++ b/plugins/knife/_knife @@ -31,7 +31,7 @@ _knife() { case $state in knifecmd) - compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" diff exec environment index node recipe role search ssh status upload windows $cloudproviders + compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" diff exec environment index node recipe role search ssh status upload vault windows $cloudproviders ;; knifesubcmd) case $words[2] in @@ -65,6 +65,9 @@ _knife() { upload) _arguments '*:file or directory:_files -g "*"' ;; + vault) + compadd -Q "$@" create decrypt delete edit remove "rotate all keys" "rotate keys" show update + ;; windows) compadd "$@" bootstrap ;; diff --git a/plugins/rake-fast/rake-fast.plugin.zsh b/plugins/rake-fast/rake-fast.plugin.zsh new file mode 100644 index 000000000..320855233 --- /dev/null +++ b/plugins/rake-fast/rake-fast.plugin.zsh @@ -0,0 +1,51 @@ +# rake-fast +# Fast rake autocompletion plugin for oh-my-zsh + +# This script caches the output for later usage and significantly speeds it up. +# It generates a .rake_tasks file in parallel to the Rakefile. + +# You'll want to add `.rake_tasks` to your global .git_ignore file: +# https://help.github.com/articles/ignoring-files#global-gitignore + +# You can force .rake_tasks to refresh with: +# $ rake_refresh + +# This is entirely based on Ullrich Schäfer's work +# (https://github.com/robb/.dotfiles/pull/10/), +# which is inspired by this Ruby on Rails trick from 2006: +# http://weblog.rubyonrails.org/2006/3/9/fast-rake-task-completion-for-zsh/ + +_rake_refresh () { + if [ -f .rake_tasks ]; then + rm .rake_tasks + fi + echo "Generating .rake_tasks..." > /dev/stderr + _rake_generate + cat .rake_tasks +} + +_rake_does_task_list_need_generating () { + if [ ! -f .rake_tasks ]; then return 0; + else + accurate=$(stat -f%m .rake_tasks) + changed=$(stat -f%m Rakefile) + return $(expr $accurate '>=' $changed) + fi +} + +_rake_generate () { + rake --silent --tasks | cut -d " " -f 2 > .rake_tasks +} + +_rake () { + if [ -f Rakefile ]; then + if _rake_does_task_list_need_generating; then + echo "\nGenerating .rake_tasks..." > /dev/stderr + _rake_generate + fi + compadd `cat .rake_tasks` + fi +} + +compdef _rake rake +alias rake_refresh='_rake_refresh' |