This changes the `config` subcommand to a config flag.
Add option subcommand for now, for the clearing of default path.
Add `ZELLIJ_CONFIG` environment variable.
The configuration locations are now as follows:
* `--config` flag
* `ZELLIJ_CONFIG` environment variable
* default config location
in that order.
90 lines
No EOL
2.7 KiB
Text
90 lines
No EOL
2.7 KiB
Text
#compdef zellij
|
|
|
|
autoload -U is-at-least
|
|
|
|
_zellij() {
|
|
typeset -A opt_args
|
|
typeset -a _arguments_options
|
|
local ret=1
|
|
|
|
if is-at-least 5.2; then
|
|
_arguments_options=(-s -S -C)
|
|
else
|
|
_arguments_options=(-s -C)
|
|
fi
|
|
|
|
local context curcontext="$curcontext" state line
|
|
_arguments "${_arguments_options[@]}" \
|
|
'-s+[Send "split (direction h == horizontal / v == vertical)" to active zellij session]' \
|
|
'--split=[Send "split (direction h == horizontal / v == vertical)" to active zellij session]' \
|
|
'-o+[Send "open file in new pane" to active zellij session]' \
|
|
'--open-file=[Send "open file in new pane" to active zellij session]' \
|
|
'--max-panes=[Maximum panes on screen, caution: opening more panes will close old ones]' \
|
|
'--data-dir=[Change where zellij looks for layouts and plugins]' \
|
|
'-l+[Path to a layout yaml file]' \
|
|
'--layout=[Path to a layout yaml file]' \
|
|
'-c+[Change where zellij looks for the configuration]' \
|
|
'--config=[Change where zellij looks for the configuration]' \
|
|
'-m[Send "move focused pane" to active zellij session]' \
|
|
'--move-focus[Send "move focused pane" to active zellij session]' \
|
|
'-d[]' \
|
|
'--debug[]' \
|
|
'-h[Prints help information]' \
|
|
'--help[Prints help information]' \
|
|
'-V[Prints version information]' \
|
|
'--version[Prints version information]' \
|
|
":: :_zellij_commands" \
|
|
"*::: :->zellij" \
|
|
&& ret=0
|
|
case $state in
|
|
(zellij)
|
|
words=($line[1] "${words[@]}")
|
|
(( CURRENT += 1 ))
|
|
curcontext="${curcontext%:*:*}:zellij-command-$line[1]:"
|
|
case $line[1] in
|
|
(option)
|
|
_arguments "${_arguments_options[@]}" \
|
|
'--clean[Disables loading of configuration file at default location]' \
|
|
'-h[Prints help information]' \
|
|
'--help[Prints help information]' \
|
|
'-V[Prints version information]' \
|
|
'--version[Prints version information]' \
|
|
&& ret=0
|
|
;;
|
|
(help)
|
|
_arguments "${_arguments_options[@]}" \
|
|
'-h[Prints help information]' \
|
|
'--help[Prints help information]' \
|
|
'-V[Prints version information]' \
|
|
'--version[Prints version information]' \
|
|
&& ret=0
|
|
;;
|
|
esac
|
|
;;
|
|
esac
|
|
}
|
|
|
|
(( $+functions[_zellij_commands] )) ||
|
|
_zellij_commands() {
|
|
local commands; commands=(
|
|
"option:Change the behaviour of zellij" \
|
|
"help:Prints this message or the help of the given subcommand(s)" \
|
|
)
|
|
_describe -t commands 'zellij commands' commands "$@"
|
|
}
|
|
(( $+functions[_zellij__help_commands] )) ||
|
|
_zellij__help_commands() {
|
|
local commands; commands=(
|
|
|
|
)
|
|
_describe -t commands 'zellij help commands' commands "$@"
|
|
}
|
|
(( $+functions[_zellij__option_commands] )) ||
|
|
_zellij__option_commands() {
|
|
local commands; commands=(
|
|
|
|
)
|
|
_describe -t commands 'zellij option commands' commands "$@"
|
|
}
|
|
|
|
_zellij "$@" |