Skip to content

Instantly share code, notes, and snippets.

@raphaeltraviss
Last active January 18, 2021 18:06
Show Gist options
  • Save raphaeltraviss/089d168605842c6f6e1c1b27ae5a906c to your computer and use it in GitHub Desktop.
Save raphaeltraviss/089d168605842c6f6e1c1b27ae5a906c to your computer and use it in GitHub Desktop.
Zsh completion for tmuxinator projects that take a file path as their first argument
# add command and project completion to tmuxinator
# add custom file path completion to your specific “my_project” project
# use this inside a ~/.tmuxinator/my_project.yml via <%= @args[0] %>
# e.g. set the root project path via ```root: <%= @args[0] %>```
#compdef _tmuxinator tmuxinator
_tmuxinator() {
local commands projects
commands=(${(f)"$(tmuxinator commands zsh)"})
projects=(${(f)"$(tmuxinator completions start)"})
if (( CURRENT == 2 )); then
_alternative \
'commands:: _describe -t commands "tmuxinator subcommands" commands' \
'projects:: _describe -t projects "tmuxinator projects" projects'
elif (( CURRENT == 3)); then
case $words[2] in
copy|cp|c|debug|delete|rm|open|o|start|s|edit|e)
_arguments '*:projects:($projects)'
;;
esac
elif (( CURRENT == 4)); then
case $words[3] in
my_project)
_arguments '*:target_dir:_files'
;;
esac
fi
return
}
name: MyProject
root: <%= @args[0] %>
windows:
- MAIN:
layout: even-horizontal
panes:
-
-
-
@raphaeltraviss
Copy link
Author

raphaeltraviss commented Jan 18, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment