Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Hatena-Project zsh completion
function h {
cd ~/work/hatena/$1
}
function _h {
local allfiles
local -a _projects _others
allfiles=`find ~/work/hatena/* -type d -maxdepth 0 -exec basename '{}' ';'`
_projects=( $(echo $allfiles | grep '^Hatena-' | sed -e 's/^Hatena-//') )
_describe -t projects "Projects" _projects -P Hatena-
_others=( $(echo $allfiles | grep -v '^Hatena-') )
_describe -t others "Others" _others
return 1;
}
compdef _h h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment