Skip to content

Instantly share code, notes, and snippets.

@tkfm-yamaguchi
Forked from ser1zw/_tmuxinator
Last active August 29, 2015 13:59
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 tkfm-yamaguchi/10711642 to your computer and use it in GitHub Desktop.
Save tkfm-yamaguchi/10711642 to your computer and use it in GitHub Desktop.
#compdef tmuxinator mux
# zsh completion for tmuxinator
# Install:
# $ mkdir -p ~/.tmuxinator/completion
# $ cp _tmuxinator ~/.tmuxinator/completion
# $ vi ~/.zshrc # add the following codes
# fpath=($HOME/.tmuxinator/completion ${fpath})
# autoload -U compinit
# compinit
_tmuxinator() {
local -a projects
projects=(`find ~/.tmuxinator -name \*.yml | cut -d/ -f5 | sed s:.yml::g`)
local -a commands
commands=(
'start:start a tmux session using project'\''s tmuxinator config'
'open:create a new project file and open it in your editor'
'copy:copy source_project project file to a new project called new_project'
'delete:deletes the project called project_name'
'implode:deletes all existing projects!'
'list:list all existing projects'
'doctor:look for problems in your configuration'
'help:shows this help document'
'version:shows tmuxinator version number'
)
if (( CURRENT == 2 )); then
_describe -t commands 'commands' commands
elif (( CURRENT == 3 )); then
case $words[2] in
copy|delete|open|start)
_arguments '*:projects:($projects)'
;;
list)
_arguments '-v[verbose]' # FIXME: doesn't work well
;;
esac
fi
return 0
}
_tmuxinator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment