Skip to content

Instantly share code, notes, and snippets.

@hakobe
Created February 9, 2012 04:37
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hakobe/1777331 to your computer and use it in GitHub Desktop.
Save hakobe/1777331 to your computer and use it in GitHub Desktop.
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