diff --git a/conf.d/zim/modules/alacritty/init.zsh b/conf.d/zim/modules/alacritty/init.zsh new file mode 100644 index 0000000..41cfe2c --- /dev/null +++ b/conf.d/zim/modules/alacritty/init.zsh @@ -0,0 +1,2 @@ +fpath+="${0:h}/src" + diff --git a/conf.d/zim/modules/alacritty/src/_alacritty b/conf.d/zim/modules/alacritty/src/_alacritty new file mode 100644 index 0000000..4f48223 --- /dev/null +++ b/conf.d/zim/modules/alacritty/src/_alacritty @@ -0,0 +1,129 @@ +#compdef alacritty + +autoload -U is-at-least + +_alacritty() { + 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[@]}" \ +'--embed=[Defines the X11 window ID (as a decimal integer) to embed Alacritty within]:EMBED: ' \ +'--config-file=[Specify alternative configuration file \[default: $XDG_CONFIG_HOME/alacritty/alacritty.yml\]]:CONFIG_FILE: ' \ +'--socket=[Path for IPC socket creation]:SOCKET: ' \ +'*-o+[Override configuration file options \[example: cursor.style=Beam\]]:OPTION: ' \ +'*--option=[Override configuration file options \[example: cursor.style=Beam\]]:OPTION: ' \ +'--working-directory=[Start the shell in the specified working directory]:WORKING_DIRECTORY: ' \ +'*-e+[Command and args to execute (must be last argument)]:COMMAND: ' \ +'*--command=[Command and args to execute (must be last argument)]:COMMAND: ' \ +'-t+[Defines the window title \[default: Alacritty\]]:TITLE: ' \ +'--title=[Defines the window title \[default: Alacritty\]]:TITLE: ' \ +'--class=[Defines window class/app_id on X11/Wayland \[default: Alacritty\]]:instance> | ,alacritty" \ +&& ret=0 + case $state in + (alacritty) + words=($line[1] "${words[@]}") + (( CURRENT += 1 )) + curcontext="${curcontext%:*:*}:alacritty-command-$line[1]:" + case $line[1] in + (msg) +_arguments "${_arguments_options[@]}" \ +'-s+[IPC socket connection path override]:SOCKET: ' \ +'--socket=[IPC socket connection path override]:SOCKET: ' \ +'-h[Print help information]' \ +'--help[Print help information]' \ +":: :_alacritty__msg_commands" \ +"*::: :->msg" \ +&& ret=0 + + case $state in + (msg) + words=($line[1] "${words[@]}") + (( CURRENT += 1 )) + curcontext="${curcontext%:*:*}:alacritty-msg-command-$line[1]:" + case $line[1] in + (create-window) +_arguments "${_arguments_options[@]}" \ +'--working-directory=[Start the shell in the specified working directory]:WORKING_DIRECTORY: ' \ +'*-e+[Command and args to execute (must be last argument)]:COMMAND: ' \ +'*--command=[Command and args to execute (must be last argument)]:COMMAND: ' \ +'-t+[Defines the window title \[default: Alacritty\]]:TITLE: ' \ +'--title=[Defines the window title \[default: Alacritty\]]:TITLE: ' \ +'--class=[Defines window class/app_id on X11/Wayland \[default: Alacritty\]]:instance> | ,