Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
zsh completion for tmuxinator
#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