summaryrefslogtreecommitdiff
path: root/plugins/tmuxinator
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/tmuxinator')
-rw-r--r--plugins/tmuxinator/README.md19
-rw-r--r--plugins/tmuxinator/_tmuxinator51
-rw-r--r--plugins/tmuxinator/tmuxinator.plugin.zsh5
3 files changed, 41 insertions, 34 deletions
diff --git a/plugins/tmuxinator/README.md b/plugins/tmuxinator/README.md
new file mode 100644
index 000000000..994d8d46d
--- /dev/null
+++ b/plugins/tmuxinator/README.md
@@ -0,0 +1,19 @@
+# Tmuxinator plugin
+
+This plugin provides completion for [tmuxinator](https://github.com/tmuxinator/tmuxinator),
+as well as aliases for frequent tmuxinator commands.
+
+To use it add `tmuxinator` to the plugins array in your zshrc file.
+
+```zsh
+plugins=(... tmuxinator)
+```
+
+## Aliases
+
+| Alias | Command | Description |
+| ------ | ---------------- | ------------------------ |
+| `txs ` | tmuxinator start | Start Tmuxinator |
+| `txo ` | tmuxinator open | Open project for editing |
+| `txn ` | tmuxinator new | Create project |
+| `txl ` | tmuxinator list | List projects |
diff --git a/plugins/tmuxinator/_tmuxinator b/plugins/tmuxinator/_tmuxinator
index 551267ed2..9ae25ac38 100644
--- a/plugins/tmuxinator/_tmuxinator
+++ b/plugins/tmuxinator/_tmuxinator
@@ -1,40 +1,23 @@
#compdef tmuxinator mux
#autoload
-local curcontext="$curcontext" state line ret=1
-local -a _configs
+_tmuxinator() {
+ local commands projects
+ commands=(${(f)"$(tmuxinator commands zsh)"})
+ projects=(${(f)"$(tmuxinator completions start)"})
-_arguments -C \
- '1: :->cmds' \
- '2:: :->args' && ret=0
-
-_configs=(${$(echo ~/.tmuxinator/*.yml):r:t})
-
-case $state in
- cmds)
- _values "tmuxinator command" \
- "new[create a new project file and open it in your editor]" \
- "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]" \
- "debug[output the shell commands generated by a projet]" \
- "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]" \
- $_configs
- ret=0
- ;;
- args)
- case $line[1] in
- start|open|copy|delete|debug)
- [[ -n "$_configs" ]] && _values 'configs' $_configs
- ret=0
- ;;
+ if (( CURRENT == 2 )); then
+ _describe -t commands "tmuxinator subcommands" commands
+ _describe -t projects "tmuxinator projects" projects
+ elif (( CURRENT == 3)); then
+ case $words[2] in
+ copy|debug|delete|open|start)
+ _arguments '*:projects:($projects)'
+ ;;
esac
- ;;
-esac
+ fi
+
+ return
+}
-return ret
+compdef _tmuxinator tmuxinator
diff --git a/plugins/tmuxinator/tmuxinator.plugin.zsh b/plugins/tmuxinator/tmuxinator.plugin.zsh
new file mode 100644
index 000000000..166fa9881
--- /dev/null
+++ b/plugins/tmuxinator/tmuxinator.plugin.zsh
@@ -0,0 +1,5 @@
+# aliases
+alias txs='tmuxinator start'
+alias txo='tmuxinator open'
+alias txn='tmuxinator new'
+alias txl='tmuxinator list'