Add completion for tmuxinator

This commit is contained in:
Ben O'Hara 2012-07-06 10:46:51 +10:00
parent d54358a43c
commit 1f97a6ad01
1 changed files with 55 additions and 0 deletions

55
_tmuxinator Normal file
View File

@ -0,0 +1,55 @@
#compdef tmuxinator mux
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for tmuxinator (https://github.com/aziz/tmuxinator).
#
# Source: https://gist.github.com/2242920
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * ser1zw (https://github.com/ser1zw)
# * Ben O'Hara (https://github.com/benohara)
#
# ------------------------------------------------------------------------------
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
# vim: ft=zsh sw=2 ts=2 et
# ------------------------------------------------------------------------------
_tmuxinator() {
local -a projects
projects=(`find $HOME/.tmuxinator/ -name \*.yml| awk -F/ '{print $NF}' | 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