Last active
January 18, 2021 18:06
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: MyProject | |
root: <%= @args[0] %> | |
windows: | |
- MAIN: | |
layout: even-horizontal | |
panes: | |
- | |
- | |
- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Based on https://github.com/tmuxinator/tmuxinator/blob/master/completion/tmuxinator.zsh with the file path argument added