Skip to content

Instantly share code, notes, and snippets.

@kmdsbng
Forked from ser1zw/_tmuxinator
Last active January 2, 2016 12:09
Show Gist options
  • Save kmdsbng/8301061 to your computer and use it in GitHub Desktop.
Save kmdsbng/8301061 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
_arguments '*:projects:($projects)'
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