Skip to content

Instantly share code, notes, and snippets.

@kei-q
Created July 8, 2012 12:46
Show Gist options
  • Select an option

  • Save kei-q/3070804 to your computer and use it in GitHub Desktop.

Select an option

Save kei-q/3070804 to your computer and use it in GitHub Desktop.
zawでzを使うためのsource。半分以上cdrから拝借
if ! (( $+functions[_z] )); then
return
fi
function zaw-src-z() {
# <rank><space><dir> の組でくるので、そこからdirだけ抜き取る
: ${(A)candidates::=${${(f)"$(z -l | sort -n -r)"}##<->(.<->)# ##}}
actions=(zaw-src-z-cd)
act_descriptions=("cd")
}
function zaw-src-z-cd() {
BUFFER="cd $1"
zle accept-line
}
zaw-register-src -n z zaw-src-z
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment