Skip to content

Instantly share code, notes, and snippets.

@dagolden
Created January 9, 2014 16:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dagolden/8337300 to your computer and use it in GitHub Desktop.
Save dagolden/8337300 to your computer and use it in GitHub Desktop.
improved tmux hack command
hack () {
local dir=$(find ~/git '(' '(' -name .git -or -name .build ')' -prune -false ')' -or -iname $1 -type d)
if [[ -n $dir && -d $dir ]]; then
tmux new-window -c $dir -n $(basename $dir)
elif [[ -n $dir ]]; then
local count=$(echo $dir | wc -w)
echo $1 ambiguous: $count matches
else
echo "$1 not found"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment