migrate to dotter

This commit is contained in:
Alexander Navarro 2025-09-01 12:10:36 -04:00
parent c5618f2f2c
commit 23b6c0a596
265 changed files with 62 additions and 3125 deletions

View file

@ -0,0 +1,64 @@
#--------------------------------------------------------------------#
# Aliases #
#--------------------------------------------------------------------#
#fix obvious typo's
alias pdw="pwd"
# File Managment
alias \
cp='cp -iv' \
mv='mv -iv' \
cpr='rsync -za --partial -hh --info=progress2' \
mvr='rsync -za --remove-source-files --partial -hh --info=progress2' \
sync='rsync -zau --delete --partial -hh --info=progress2' \
del='trash -i' \
rmf='rm -rfI' \
md='mkdir -pv' \
ls='eza -lh --color=always --icons --git ' \
la='eza -alh --color=always --icons --git ' \
ld='eza -la --no-permissions --no-filesize --no-time --no-time --no-user' \
mkexec='chmod +x'
# Search and Query Files
alias grep="rg --sort path --pretty --context 3"
# Quicly update Stuff
alias vi-ssh="vi ~/.ssh/config"
# Query Stuff
alias \
ip='ip -human -color -brief addr' \
df="duf --hide special --hide-mp '/boot,/boot/*'" \
du='dust --reverse' \
du1='dust --reverse --min-size 1M --depth 1' \
du2='dust --reverse --min-size 1M --depth 2' \
du3='dust --reverse --min-size 1M --depth 3' \
cat='bat'
alias \
dco='docker compose' \
dps="docker ps --format 'table {{.ID}}\t{{.Names}}\t{{.State}}\t{{.Status}}\t{{.RunningFor}}'"
alias \
pco='podman compose' \
pps="podman ps --format 'table {{.ID}}\t{{.Names}}\t{{.State}}\t{{.Status}}\t{{.RunningFor}}'" \
psd="/usr/lib/systemd/system-generators/podman-system-generator --user --dryrun | bat -l ini"
alias \
sysctl='sudo systemctl' \
sysctl-user='systemctl --user'
# Misc
alias \
reload='exec $SHELL -l'
# Specific Mac overrides
if [[ "$OSTYPE" != 'linux-gnu' ]]; then
fi
#--------------------------------------------------------------------#
# Global #
#--------------------------------------------------------------------#
alias -g NULL='> /dev/null 2>&1'

View file

@ -0,0 +1,4 @@
alias \
ckb='cd ~/qmk_firmware && $EDITOR keyboards/sofle/keymaps/aleee-idk' \
cz='chezmoi' \
dots='chezmoi edit'

View file

@ -0,0 +1 @@
alias fzf-fp='fzf-flatpak-install-widget'

View file

@ -0,0 +1,21 @@
alias \
vi='nvim' \
vi-unstable='NVIM_APPNAME=nvim_unstable nvim'
vis() {
items=(
default
AstroNvim
LazyVim
)
config=$(printf "%s\n" "${items[@]}" | fzf --prompt=" Neovim Config  " --height=~50% --layout=reverse --border --exit-0)
if [[ -z $config ]]; then
echo "Nothing selected"
return 0
elif [[ $config == "default" ]]; then
config=""
fi
NVIM_APPNAME=$config nvim $@
}

View file

@ -0,0 +1,47 @@
alias p='pnpm'
# Dependencies
alias pa='pnpm add'
alias pad='pnpm add --save-dev'
alias pap='pnpm add --save-peer'
alias prm='pnpm remove'
alias pin='pnpm install'
alias pls='pnpm list'
alias pu='pnpm update'
alias puil='pnpm update --interactive --latest'
# Global dependencies
alias pga='pnpm add --global'
alias pgls='pnpm list --global'
alias pgrm='pnpm remove --global'
alias pgu='pnpm update --global'
# WorkSpace
alias pwa='pnpm add --workspace'
alias pwls='pnpm list --workspace'
alias pwrm='pnpm remove --workspace'
alias pwu='pnpm update --workspace'
# Run scripts
alias prun='pnpm run'
alias pd='pnpm run dev'
alias pb='pnpm run build'
alias psv='pnpm run serve'
alias pst='pnpm start'
alias pt='pnpm test'
alias ptc='pnpm test --coverage'
alias pln='pnpm run lint'
alias pdocs='pnpm run docs'
alias pex='pnpm exec'
alias pdx='pnpm dlx'
# Misc
alias pi='pnpm init'
alias ppub='pnpm publish'
alias pc='pnpm create'
# Monorepo
alias pf='pnpm -r --filter'
# qwik
alias pre='pnpm run preview'

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,144 @@
#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=[X11 window ID to embed Alacritty within (decimal or hexadecimal with "0x" prefix)]:EMBED: ' \
'--config-file=[Specify alternative configuration file \[default: $XDG_CONFIG_HOME/alacritty/alacritty.yml\]]:CONFIG_FILE:_files' \
'--socket=[Path for IPC socket creation]:SOCKET:_files' \
'*-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:_files' \
'*-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> | <instance>,<general: ' \
'-h[Print help information]' \
'--help[Print help information]' \
'-V[Print version information]' \
'--version[Print version information]' \
'--print-events[Print all events to stdout]' \
'--ref-test[Generates ref test]' \
'(-v)*-q[Reduces the level of verbosity (the min level is -qq)]' \
'(-q)*-v[Increases the level of verbosity (the max level is -vvv)]' \
'--hold[Remain open after child process exit]' \
":: :_alacritty_commands" \
"*::: :->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:_files' \
'--socket=[IPC socket connection path override]:SOCKET:_files' \
'-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:_files' \
'*-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> | <instance>,<general: ' \
'--hold[Remain open after child process exit]' \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(config)
_arguments "${_arguments_options[@]}" \
'-w+[Window ID for the new config]:WINDOW_ID: ' \
'--window-id=[Window ID for the new config]:WINDOW_ID: ' \
'()-r[Clear all runtime configuration changes]' \
'()--reset[Clear all runtime configuration changes]' \
'-h[Print help information]' \
'--help[Print help information]' \
'*::options -- Configuration file options \[example\: cursor.style=Beam\]:' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
'*::subcommand -- The subcommand whose help message to display:' \
&& ret=0
;;
esac
;;
esac
;;
(help)
_arguments "${_arguments_options[@]}" \
'*::subcommand -- The subcommand whose help message to display:' \
&& ret=0
;;
esac
;;
esac
}
(( $+functions[_alacritty_commands] )) ||
_alacritty_commands() {
local commands; commands=(
'msg:Send a message to the Alacritty socket' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'alacritty commands' commands "$@"
}
(( $+functions[_alacritty__msg__config_commands] )) ||
_alacritty__msg__config_commands() {
local commands; commands=()
_describe -t commands 'alacritty msg config commands' commands "$@"
}
(( $+functions[_alacritty__msg__create-window_commands] )) ||
_alacritty__msg__create-window_commands() {
local commands; commands=()
_describe -t commands 'alacritty msg create-window commands' commands "$@"
}
(( $+functions[_alacritty__help_commands] )) ||
_alacritty__help_commands() {
local commands; commands=()
_describe -t commands 'alacritty help commands' commands "$@"
}
(( $+functions[_alacritty__msg__help_commands] )) ||
_alacritty__msg__help_commands() {
local commands; commands=()
_describe -t commands 'alacritty msg help commands' commands "$@"
}
(( $+functions[_alacritty__msg_commands] )) ||
_alacritty__msg_commands() {
local commands; commands=(
'create-window:Create a new window in the same Alacritty process' \
'config:Update the Alacritty configuration' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'alacritty msg commands' commands "$@"
}
_alacritty "$@"

View file

@ -0,0 +1,447 @@
#compdef cargo
autoload -U regexp-replace
_cargo() {
local curcontext="$curcontext" ret=1
local -a command_scope_spec common parallel features msgfmt triple target registry
local -a state line state_descr # These are set by _arguments
typeset -A opt_args
common=(
'(-q --quiet)*'{-v,--verbose}'[use verbose output]'
'(-q --quiet -v --verbose)'{-q,--quiet}'[no output printed to stdout]'
'-Z+[pass unstable (nightly-only) flags to cargo]: :_cargo_unstable_flags'
'--frozen[require that Cargo.lock and cache are up-to-date]'
'--locked[require that Cargo.lock is up-to-date]'
'--color=[specify colorization option]:coloring:(auto always never)'
'(- 1 *)'{-h,--help}'[show help message]'
)
# leading items in parentheses are an exclusion list for the arguments following that arg
# See: http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-Functions
# - => exclude all other options
# 1 => exclude positional arg 1
# * => exclude all other args
# +blah => exclude +blah
_arguments -s -S -C $common \
'(- 1 *)--list[list installed commands]' \
'(- 1 *)--explain=[provide a detailed explanation of an error message]:error code' \
'(- 1 *)'{-V,--version}'[show version information]' \
'(+beta +nightly)+stable[use the stable toolchain]' \
'(+stable +nightly)+beta[use the beta toolchain]' \
'(+stable +beta)+nightly[use the nightly toolchain]' \
'1: :_cargo_cmds' \
'*:: :->args'
# These flags are mutually exclusive specifiers for the scope of a command; as
# they are used in multiple places without change, they are expanded into the
# appropriate command's `_arguments` where appropriate.
command_scope_spec=(
'(--bin --example --test --lib)--bench=[specify benchmark name]: :_cargo_benchmark_names'
'(--bench --bin --test --lib)--example=[specify example name]:example name:_cargo_example_names'
'(--bench --example --test --lib)--bin=[specify binary name]:binary name'
'(--bench --bin --example --test)--lib=[specify library name]:library name'
'(--bench --bin --example --lib)--test=[specify test name]:test name'
)
parallel=(
'(-j --jobs)'{-j+,--jobs=}'[specify number of parallel jobs]:jobs [# of CPUs]'
'--keep-going[do not abort build on first error]'
)
features=(
'(--all-features)'{-F+,--features=}'[specify features to activate]:feature'
'(--features -F)--all-features[activate all available features]'
"--no-default-features[don't build the default features]"
)
msgfmt='--message-format=[specify error format]:error format [human]:(human json short)'
triple='--target=[specify target triple]:target triple:_cargo_target_triple'
target='--target-dir=[specify directory for all generated artifacts]:directory:_directories'
manifest='--manifest-path=[specify path to manifest]:path:_directories'
registry='--registry=[specify registry to use]:registry'
case $state in
args)
curcontext="${curcontext%:*}-${words[1]}:"
case ${words[1]} in
add)
_arguments -s -A "^--" $common $manifest $registry \
{-F+,--features=}'[specify features to activate]:feature' \
"--default-features[enable the default features]" \
"--no-default-features[don't enable the default features]" \
"--optional[mark the dependency as optional]" \
"--no-optional[mark the dependency as required]" \
"--dev[add as a dev dependency]" \
"--build[add as a build dependency]" \
"--target=[add as a dependency to the given target platform]" \
"--rename=[rename the dependency]" \
"--dry-run[don't actually write the manifest]" \
'--branch=[branch to use when adding from git]:branch' \
'--git=[specify URL from which to add the crate]:url:_urls' \
'--path=[local filesystem path to crate to add]: :_directories' \
'--rev=[specific commit to use when adding from git]:commit' \
'--tag=[tag to use when adding from git]:tag' \
'1: :_guard "^-*" "crate name"' \
'*:args:_default'
;;
bench)
_arguments -s -A "^--" $common $parallel $features $msgfmt $triple $target $manifest \
"${command_scope_spec[@]}" \
'--all-targets[benchmark all targets]' \
"--no-run[compile but don't run]" \
'(-p --package)'{-p+,--package=}'[specify package to run benchmarks for]:package:_cargo_package_names' \
'--exclude=[exclude packages from the benchmark]:spec' \
'--no-fail-fast[run all benchmarks regardless of failure]' \
'1: :_guard "^-*" "bench name"' \
'*:args:_default'
;;
build | b)
_arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
'--all-targets[equivalent to specifying --lib --bins --tests --benches --examples]' \
"${command_scope_spec[@]}" \
'(-p --package)'{-p+,--package=}'[specify package to build]:package:_cargo_package_names' \
'--release[build in release mode]' \
'--build-plan[output the build plan in JSON]' \
;;
check | c)
_arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
'--all-targets[equivalent to specifying --lib --bins --tests --benches --examples]' \
"${command_scope_spec[@]}" \
'(-p --package)'{-p+,--package=}'[specify package to check]:package:_cargo_package_names' \
'--release[check in release mode]' \
;;
clean)
_arguments -s -S $common $triple $target $manifest \
'(-p --package)'{-p+,--package=}'[specify package to clean]:package:_cargo_package_names' \
'--release[clean release artifacts]' \
'--doc[clean just the documentation directory]'
;;
doc | d)
_arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
'--no-deps[do not build docs for dependencies]' \
'--document-private-items[include non-public items in the documentation]' \
'--open[open docs in browser after the build]' \
'(-p --package)'{-p+,--package=}'[specify package to document]:package:_cargo_package_names' \
'--release[build artifacts in release mode, with optimizations]' \
;;
fetch)
_arguments -s -S $common $triple $manifest
;;
fix)
_arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
"${command_scope_spec[@]}" \
'--broken-code[fix code even if it already has compiler errors]' \
'--edition[fix in preparation for the next edition]' \
'--edition-idioms[fix warnings to migrate to the idioms of an edition]' \
'--allow-no-vcs[fix code even if a VCS was not detected]' \
'--allow-dirty[fix code even if the working directory is dirty]' \
'--allow-staged[fix code even if the working directory has staged changes]'
;;
generate-lockfile)
_arguments -s -S $common $manifest
;;
help)
_cargo_cmds
;;
init)
_arguments -s -S $common $registry \
'--lib[use library template]' \
'--edition=[specify edition to set for the crate generated]:edition:(2015 2018 2021)' \
'--vcs=[initialize a new repo with a given VCS]:vcs:(git hg pijul fossil none)' \
'--name=[set the resulting package name]:name' \
'1:path:_directories'
;;
install)
_arguments -s -S $common $parallel $features $triple $registry \
'(-f --force)'{-f,--force}'[force overwriting of existing crates or binaries]' \
'--bin=[only install the specified binary]:binary' \
'--branch=[branch to use when installing from git]:branch' \
'--debug[Build in debug mode (with the "dev" profile) instead of release mode]' \
'--example=[install the specified example instead of binaries]:example:_cargo_example_names' \
'--git=[specify URL from which to install the crate]:url:_urls' \
'--path=[local filesystem path to crate to install]: :_directories' \
'--rev=[specific commit to use when installing from git]:commit' \
'--root=[directory to install packages into]: :_directories' \
'--tag=[tag to use when installing from git]:tag' \
'--version=[version to install from crates.io]:version' \
'--list[list all installed packages and their versions]' \
'*: :_guard "^-*" "crate"'
;;
locate-project)
_arguments -s -S $common $manifest \
'--message-format=[specify output representation]:output representation [json]:(json plain)' \
'--workspace[locate Cargo.toml of the workspace root]'
;;
login)
_arguments -s -S $common $registry \
'*: :_guard "^-*" "token"'
;;
metadata)
_arguments -s -S $common $features $manifest \
"--no-deps[output information only about the root package and don't fetch dependencies]" \
'--format-version=[specify format version]:version [1]:(1)'
;;
new)
_arguments -s -S $common $registry \
'--lib[use library template]' \
'--vcs:initialize a new repo with a given VCS:(git hg none)' \
'--name=[set the resulting package name]'
;;
owner)
_arguments -s -S $common $registry \
'(-a --add)'{-a,--add}'[specify name of a user or team to invite as an owner]:name' \
'--index=[specify registry index]:index' \
'(-l --list)'{-l,--list}'[list owners of a crate]' \
'(-r --remove)'{-r,--remove}'[specify name of a user or team to remove as an owner]:name' \
'--token=[specify API token to use when authenticating]:token' \
'*: :_guard "^-*" "crate"'
;;
package)
_arguments -s -S $common $parallel $features $triple $target $manifest \
'(-l --list)'{-l,--list}'[print files included in a package without making one]' \
'--no-metadata[ignore warnings about a lack of human-usable metadata]' \
'--allow-dirty[allow dirty working directories to be packaged]' \
"--no-verify[don't build to verify contents]"
;;
pkgid)
_arguments -s -S $common $manifest \
'(-p --package)'{-p+,--package=}'[specify package to get ID specifier for]:package:_cargo_package_names' \
'*: :_guard "^-*" "spec"'
;;
publish)
_arguments -s -S $common $parallel $features $triple $target $manifest $registry \
'--index=[specify registry index]:index' \
'--allow-dirty[allow dirty working directories to be packaged]' \
"--no-verify[don't verify the contents by building them]" \
'--token=[specify token to use when uploading]:token' \
'--dry-run[perform all checks without uploading]'
;;
read-manifest)
_arguments -s -S $common $manifest
;;
run | r)
_arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
'--example=[name of the bin target]:name:_cargo_example_names' \
'--bin=[name of the bin target]:name' \
'(-p --package)'{-p+,--package=}'[specify package with the target to run]:package:_cargo_package_names' \
'--release[build in release mode]' \
'*: :_default'
;;
rustc)
_arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
'(-p --package)'{-p+,--package=}'[specify package to build]:package:_cargo_package_names' \
'--profile=[specify profile to build the selected target for]:profile' \
'--release[build artifacts in release mode, with optimizations]' \
"${command_scope_spec[@]}" \
'*: : _dispatch rustc rustc -default-'
;;
rustdoc)
_arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
'--document-private-items[include non-public items in the documentation]' \
'--open[open the docs in a browser after the operation]' \
'(-p --package)'{-p+,--package=}'[specify package to document]:package:_cargo_package_names' \
'--release[build artifacts in release mode, with optimizations]' \
"${command_scope_spec[@]}" \
'*: : _dispatch rustdoc rustdoc -default-'
;;
search)
_arguments -s -S $common $registry \
'--index=[specify registry index]:index' \
'--limit=[limit the number of results]:results [10]' \
'*: :_guard "^-*" "query"'
;;
test | t)
_arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \
'--test=[test name]: :_cargo_test_names' \
'--no-fail-fast[run all tests regardless of failure]' \
'--no-run[compile but do not run]' \
'(-p --package)'{-p+,--package=}'[package to run tests for]:package:_cargo_package_names' \
'--all[test all packages in the workspace]' \
'--release[build artifacts in release mode, with optimizations]' \
'1: :_cargo_test_names' \
'(--doc --bin --example --test --bench)--lib[only test library]' \
'(--lib --bin --example --test --bench)--doc[only test documentation]' \
'(--lib --doc --example --test --bench)--bin=[binary name]' \
'(--lib --doc --bin --test --bench)--example=[example name]:_cargo_example_names' \
'(--lib --doc --bin --example --bench)--test=[test name]' \
'(--lib --doc --bin --example --test)--bench=[benchmark name]' \
'*: :_default'
;;
tree)
_arguments -s -S $common $features $triple $manifest \
'(-p --package)'{-p+,--package=}'[package to use as the root]:package:_cargo_package_names' \
'(-i --invert)'{-i+,--invert=}'[invert the tree for the given package]:package:_cargo_package_names' \
'--prefix=[line prefix]:prefix:(depth indent none)' \
'--no-dedupe[repeat shared dependencies]' \
'(-d --duplicates)'{-d,--duplicates}'[packages with multiple versions]' \
'--charset=[utf8 or ascii]:charset:(utf8 ascii)' \
'(-f --format)'{-f,--format=}'[format string]:format' \
'(-e --edges)'{-e,--edges=}'[edge kinds]:kind:(features normal build dev all no-dev no-build no-normal)' \
;;
uninstall)
_arguments -s -S $common \
'(-p --package)'{-p+,--package=}'[specify package to uninstall]:package:_cargo_package_names' \
'--bin=[only uninstall the specified binary]:name' \
'--root=[directory to uninstall packages from]: :_files -/' \
'*:crate:_cargo_installed_crates -F line'
;;
update)
_arguments -s -S $common $manifest \
'--aggressive=[force dependency update]' \
"--dry-run[don't actually write the lockfile]" \
'(-p --package)'{-p+,--package=}'[specify package to update]:package:_cargo_package_names' \
'--precise=[update single dependency to precise release]:release'
;;
verify-project)
_arguments -s -S $common $manifest
;;
version)
_arguments -s -S $common
;;
yank)
_arguments -s -S $common $registry \
'--version=[specify yank version]:version' \
'--undo[undo a yank, putting a version back into the index]' \
'--index=[specify registry index to yank from]:registry index' \
'--token=[specify API token to use when authenticating]:token' \
'*: :_guard "^-*" "crate"'
;;
*)
# allow plugins to define their own functions
if ! _call_function ret _cargo-${words[1]}; then
# fallback on default completion for unknown commands
_default && ret=0
fi
(( ! ret ))
;;
esac
;;
esac
}
_cargo_unstable_flags() {
local flags
flags=( help ${${${(M)${(f)"$(_call_program flags cargo -Z help)"}:#*--*}/ #-- #/:}##*-Z } )
_describe -t flags 'unstable flag' flags
}
_cargo_installed_crates() {
local expl
_description crates expl 'crate'
compadd "$@" "$expl[@]" - ${${${(f)"$(cargo install --list)"}:# *}%% *}
}
_cargo_cmds() {
local -a commands
# This uses Parameter Expansion Flags, which are a built-in Zsh feature.
# See more: http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion-Flags
# and http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion
#
# # How this work?
#
# First it splits the result of `cargo --list` at newline, then it removes the first line.
# Then it removes indentation (4 whitespaces) before each items. (Note the x## pattern [1]).
# Then it replaces those spaces between item and description with a `:`
#
# [1]: https://github.com/zsh-users/zsh-completions/blob/master/zsh-completions-howto.org#patterns
commands=( ${${${(M)"${(f)$(_call_program commands cargo --list)}":# *}/ ##/}/ ##/:} )
_describe -t commands 'command' commands
}
_cargo_target_triple() {
local -a targets
targets=( ${(f)"$(rustc --print target-list)"} )
_describe 'target triple' targets
}
#FIXME: Disabled until fixed
#gets package names from the manifest file
_cargo_package_names() {
_message -e packages package
}
# Extracts the values of "name" from the array given in $1 and shows them as
# command line options for completion
_cargo_names_from_array() {
local manifest=$(cargo locate-project --message-format plain)
if [[ -z $manifest ]]; then
return 0
fi
local last_line
local -a names;
local in_block=false
local block_name=$1
names=()
while read -r line; do
if [[ $last_line == "[[$block_name]]" ]]; then
in_block=true
else
if [[ $last_line =~ '\s*\[\[.*' ]]; then
in_block=false
fi
fi
if [[ $in_block == true ]]; then
if [[ $line =~ '\s*name\s*=' ]]; then
regexp-replace line '^\s*name\s*=\s*|"' ''
names+=( "$line" )
fi
fi
last_line=$line
done < "$manifest"
_describe "$block_name" names
}
#Gets the test names from the manifest file
_cargo_test_names() {
_cargo_names_from_array "test"
}
#Gets the bench names from the manifest file
_cargo_benchmark_names() {
_cargo_names_from_array "bench"
}
_cargo_example_names() {
if [[ -d examples ]]; then
local -a files=(${(@f)$(echo examples/*.rs(:t:r))})
_values 'example' "${files[@]}"
fi
}
_cargo

View file

@ -0,0 +1,212 @@
#compdef chezmoi
compdef _chezmoi chezmoi
# zsh completion for chezmoi -*- shell-script -*-
__chezmoi_debug()
{
local file="$BASH_COMP_DEBUG_FILE"
if [[ -n ${file} ]]; then
echo "$*" >> "${file}"
fi
}
_chezmoi()
{
local shellCompDirectiveError=1
local shellCompDirectiveNoSpace=2
local shellCompDirectiveNoFileComp=4
local shellCompDirectiveFilterFileExt=8
local shellCompDirectiveFilterDirs=16
local shellCompDirectiveKeepOrder=32
local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace keepOrder
local -a completions
__chezmoi_debug "\n========= starting completion logic =========="
__chezmoi_debug "CURRENT: ${CURRENT}, words[*]: ${words[*]}"
# The user could have moved the cursor backwards on the command-line.
# We need to trigger completion from the $CURRENT location, so we need
# to truncate the command-line ($words) up to the $CURRENT location.
# (We cannot use $CURSOR as its value does not work when a command is an alias.)
words=("${=words[1,CURRENT]}")
__chezmoi_debug "Truncated words[*]: ${words[*]},"
lastParam=${words[-1]}
lastChar=${lastParam[-1]}
__chezmoi_debug "lastParam: ${lastParam}, lastChar: ${lastChar}"
# For zsh, when completing a flag with an = (e.g., chezmoi -n=<TAB>)
# completions must be prefixed with the flag
setopt local_options BASH_REMATCH
if [[ "${lastParam}" =~ '-.*=' ]]; then
# We are dealing with a flag with an =
flagPrefix="-P ${BASH_REMATCH}"
fi
# Prepare the command to obtain completions
requestComp="${words[1]} __complete ${words[2,-1]}"
if [ "${lastChar}" = "" ]; then
# If the last parameter is complete (there is a space following it)
# We add an extra empty parameter so we can indicate this to the go completion code.
__chezmoi_debug "Adding extra empty parameter"
requestComp="${requestComp} \"\""
fi
__chezmoi_debug "About to call: eval ${requestComp}"
# Use eval to handle any environment variables and such
out=$(eval ${requestComp} 2>/dev/null)
__chezmoi_debug "completion output: ${out}"
# Extract the directive integer following a : from the last line
local lastLine
while IFS='\n' read -r line; do
lastLine=${line}
done < <(printf "%s\n" "${out[@]}")
__chezmoi_debug "last line: ${lastLine}"
if [ "${lastLine[1]}" = : ]; then
directive=${lastLine[2,-1]}
# Remove the directive including the : and the newline
local suffix
(( suffix=${#lastLine}+2))
out=${out[1,-$suffix]}
else
# There is no directive specified. Leave $out as is.
__chezmoi_debug "No directive found. Setting do default"
directive=0
fi
__chezmoi_debug "directive: ${directive}"
__chezmoi_debug "completions: ${out}"
__chezmoi_debug "flagPrefix: ${flagPrefix}"
if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then
__chezmoi_debug "Completion received error. Ignoring completions."
return
fi
local activeHelpMarker="_activeHelp_ "
local endIndex=${#activeHelpMarker}
local startIndex=$((${#activeHelpMarker}+1))
local hasActiveHelp=0
while IFS='\n' read -r comp; do
# Check if this is an activeHelp statement (i.e., prefixed with $activeHelpMarker)
if [ "${comp[1,$endIndex]}" = "$activeHelpMarker" ];then
__chezmoi_debug "ActiveHelp found: $comp"
comp="${comp[$startIndex,-1]}"
if [ -n "$comp" ]; then
compadd -x "${comp}"
__chezmoi_debug "ActiveHelp will need delimiter"
hasActiveHelp=1
fi
continue
fi
if [ -n "$comp" ]; then
# If requested, completions are returned with a description.
# The description is preceded by a TAB character.
# For zsh's _describe, we need to use a : instead of a TAB.
# We first need to escape any : as part of the completion itself.
comp=${comp//:/\\:}
local tab="$(printf '\t')"
comp=${comp//$tab/:}
__chezmoi_debug "Adding completion: ${comp}"
completions+=${comp}
lastComp=$comp
fi
done < <(printf "%s\n" "${out[@]}")
# Add a delimiter after the activeHelp statements, but only if:
# - there are completions following the activeHelp statements, or
# - file completion will be performed (so there will be choices after the activeHelp)
if [ $hasActiveHelp -eq 1 ]; then
if [ ${#completions} -ne 0 ] || [ $((directive & shellCompDirectiveNoFileComp)) -eq 0 ]; then
__chezmoi_debug "Adding activeHelp delimiter"
compadd -x "--"
hasActiveHelp=0
fi
fi
if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then
__chezmoi_debug "Activating nospace."
noSpace="-S ''"
fi
if [ $((directive & shellCompDirectiveKeepOrder)) -ne 0 ]; then
__chezmoi_debug "Activating keep order."
keepOrder="-V"
fi
if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then
# File extension filtering
local filteringCmd
filteringCmd='_files'
for filter in ${completions[@]}; do
if [ ${filter[1]} != '*' ]; then
# zsh requires a glob pattern to do file filtering
filter="\*.$filter"
fi
filteringCmd+=" -g $filter"
done
filteringCmd+=" ${flagPrefix}"
__chezmoi_debug "File filtering command: $filteringCmd"
_arguments '*:filename:'"$filteringCmd"
elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then
# File completion for directories only
local subdir
subdir="${completions[1]}"
if [ -n "$subdir" ]; then
__chezmoi_debug "Listing directories in $subdir"
pushd "${subdir}" >/dev/null 2>&1
else
__chezmoi_debug "Listing directories in ."
fi
local result
_arguments '*:dirname:_files -/'" ${flagPrefix}"
result=$?
if [ -n "$subdir" ]; then
popd >/dev/null 2>&1
fi
return $result
else
__chezmoi_debug "Calling _describe"
if eval _describe $keepOrder "completions" completions $flagPrefix $noSpace; then
__chezmoi_debug "_describe found some completions"
# Return the success of having called _describe
return 0
else
__chezmoi_debug "_describe did not find completions."
__chezmoi_debug "Checking if we should do file completion."
if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then
__chezmoi_debug "deactivating file completion"
# We must return an error code here to let zsh know that there were no
# completions found by _describe; this is what will trigger other
# matching algorithms to attempt to find completions.
# For example zsh can match letters in the middle of words.
return 1
else
# Perform file completion
__chezmoi_debug "Activating file completion"
# We must return the result of this command, so it must be the
# last command, or else we must store its result to return it.
_arguments '*:filename:_files'" ${flagPrefix}"
fi
fi
fi
}
# don't run the completion function when being source-ed or eval-ed
if [ "$funcstack[1]" = "_chezmoi" ]; then
_chezmoi
fi

View file

@ -0,0 +1,20 @@
#compdef cht.sh
__CHTSH_LANGS=($(curl -s cheat.sh/:list))
_arguments -C \
'--help[show this help message and exit]: :->noargs' \
'--shell[enter shell repl]: :->noargs' \
'1:Cheat Sheet:->lang' \
'*::: :->noargs' && return 0
if [[ CURRENT -ge 1 ]]; then
case $state in
noargs)
_message "nothing to complete";;
lang)
compadd -X "Cheat Sheets" ${__CHTSH_LANGS[@]};;
*)
_message "Unknown state, error in autocomplete";;
esac
return
fi

View file

@ -0,0 +1 @@
_comp_options+=(globdots) # With hidden files

View file

@ -0,0 +1,177 @@
#compdef just
autoload -U is-at-least
_just() {
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
local common=(
'(--no-aliases)--alias-style=[Set list command alias display style]: :(left right separate)' \
'--chooser=[Override binary invoked by \`--choose\`]: :_default' \
'--color=[Print colorful output]: :(auto always never)' \
'--command-color=[Echo recipe lines in <COMMAND-COLOR>]: :(black blue cyan green purple red yellow)' \
'(-E --dotenv-path)--dotenv-filename=[Search for environment file named <DOTENV-FILENAME> instead of \`.env\`]: :_default' \
'-E+[Load <DOTENV-PATH> as environment file instead of searching for one]: :_files' \
'--dotenv-path=[Load <DOTENV-PATH> as environment file instead of searching for one]: :_files' \
'--dump-format=[Dump justfile as <FORMAT>]:FORMAT:(json just)' \
'-f+[Use <JUSTFILE> as justfile]: :_files' \
'--justfile=[Use <JUSTFILE> as justfile]: :_files' \
'--list-heading=[Print <TEXT> before list]:TEXT:_default' \
'--list-prefix=[Print <TEXT> before each list item]:TEXT:_default' \
'*--set=[Override <VARIABLE> with <VALUE>]: :(_just_variables)' \
'--shell=[Invoke <SHELL> to run recipes]: :_default' \
'*--shell-arg=[Invoke shell with <SHELL-ARG> as an argument]: :_default' \
'--timestamp-format=[Timestamp format string]: :_default' \
'-d+[Use <WORKING-DIRECTORY> as working directory. --justfile must also be set]: :_files' \
'--working-directory=[Use <WORKING-DIRECTORY> as working directory. --justfile must also be set]: :_files' \
'*-c+[Run an arbitrary command with the working directory, \`.env\`, overrides, and exports set]: :_default' \
'*--command=[Run an arbitrary command with the working directory, \`.env\`, overrides, and exports set]: :_default' \
'--completions=[Print shell completion script for <SHELL>]:SHELL:(bash elvish fish nushell powershell zsh)' \
'()-l+[List available recipes]' \
'()--list=[List available recipes]' \
'--request=[Execute <REQUEST>. For internal testing purposes only. May be changed or removed at any time.]: :_default' \
'-s+[Show recipe at <PATH>]: :(_just_commands)' \
'--show=[Show recipe at <PATH>]: :(_just_commands)' \
'--check[Run \`--fmt\` in '\''check'\'' mode. Exits with 0 if justfile is formatted correctly. Exits with 1 and prints a diff if formatting is required.]' \
'--clear-shell-args[Clear shell arguments]' \
'(-q --quiet)-n[Print what just would do without doing it]' \
'(-q --quiet)--dry-run[Print what just would do without doing it]' \
'--explain[Print recipe doc comment before running it]' \
'(-f --justfile -d --working-directory)-g[Use global justfile]' \
'(-f --justfile -d --working-directory)--global-justfile[Use global justfile]' \
'--highlight[Highlight echoed recipe lines in bold]' \
'--list-submodules[List recipes in submodules]' \
'--no-aliases[Don'\''t show aliases in list]' \
'--no-deps[Don'\''t run recipe dependencies]' \
'--no-dotenv[Don'\''t load \`.env\` file]' \
'--no-highlight[Don'\''t highlight echoed recipe lines in bold]' \
'--one[Forbid multiple recipes from being invoked on the command line]' \
'(-n --dry-run)-q[Suppress all output]' \
'(-n --dry-run)--quiet[Suppress all output]' \
'--allow-missing[Ignore missing recipe and module errors]' \
'--shell-command[Invoke <COMMAND> with the shell used to run recipe lines and backticks]' \
'--timestamp[Print recipe command timestamps]' \
'-u[Return list and summary entries in source order]' \
'--unsorted[Return list and summary entries in source order]' \
'--unstable[Enable unstable features]' \
'*-v[Use verbose output]' \
'*--verbose[Use verbose output]' \
'--yes[Automatically confirm all recipes.]' \
'--changelog[Print changelog]' \
'--choose[Select one or more recipes to run using a binary chooser. If \`--chooser\` is not passed the chooser defaults to the value of \$JUST_CHOOSER, falling back to \`fzf\`]' \
'--dump[Print justfile]' \
'-e[Edit justfile with editor given by \$VISUAL or \$EDITOR, falling back to \`vim\`]' \
'--edit[Edit justfile with editor given by \$VISUAL or \$EDITOR, falling back to \`vim\`]' \
'--evaluate[Evaluate and print all variables. If a variable name is given as an argument, only print that variable'\''s value.]' \
'--fmt[Format and overwrite justfile]' \
'--groups[List recipe groups]' \
'--init[Initialize new justfile in project root]' \
'--man[Print man page]' \
'--summary[List names of available recipes]' \
'--variables[List names of variables]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
)
_arguments "${_arguments_options[@]}" $common \
'1: :_just_commands' \
'*: :->args' \
&& ret=0
case $state in
args)
curcontext="${curcontext%:*}-${words[2]}:"
local lastarg=${words[${#words}]}
local recipe
local cmds; cmds=(
${(s: :)$(_call_program commands just --summary)}
)
# Find first recipe name
for ((i = 2; i < $#words; i++ )) do
if [[ ${cmds[(I)${words[i]}]} -gt 0 ]]; then
recipe=${words[i]}
break
fi
done
if [[ $lastarg = */* ]]; then
# Arguments contain slash would be recognised as a file
_arguments -s -S $common '*:: :_files'
elif [[ $lastarg = *=* ]]; then
# Arguments contain equal would be recognised as a variable
_message "value"
elif [[ $recipe ]]; then
# Show usage message
_message "`just --show $recipe`"
# Or complete with other commands
#_arguments -s -S $common '*:: :_just_commands'
else
_arguments -s -S $common '*:: :_just_commands'
fi
;;
esac
return ret
}
(( $+functions[_just_commands] )) ||
_just_commands() {
[[ $PREFIX = -* ]] && return 1
integer ret=1
local variables; variables=(
${(s: :)$(_call_program commands just --variables)}
)
local commands; commands=(
${${${(M)"${(f)$(_call_program commands just --list)}":# *}/ ##/}/ ##/:Args: }
)
if compset -P '*='; then
case "${${words[-1]%=*}#*=}" in
*) _message 'value' && ret=0 ;;
esac
else
_describe -t variables 'variables' variables -qS "=" && ret=0
_describe -t commands 'just commands' commands "$@"
fi
}
if [ "$funcstack[1]" = "_just" ]; then
(( $+functions[_just_variables] )) ||
_just_variables() {
[[ $PREFIX = -* ]] && return 1
integer ret=1
local variables; variables=(
${(s: :)$(_call_program commands just --variables)}
)
if compset -P '*='; then
case "${${words[-1]%=*}#*=}" in
*) _message 'value' && ret=0 ;;
esac
else
_describe -t variables 'variables' variables && ret=0
fi
return ret
}
_just "$@"
else
compdef _just just
fi

View file

@ -0,0 +1,86 @@
#compdef lsd
autoload -U is-at-least
_lsd() {
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[@]}" \
'*--color=[When to use terminal colours]: :(always auto never)' \
'*--icon=[When to print the icons]: :(always auto never)' \
'*--icon-theme=[Whether to use fancy or unicode icons]: :(fancy unicode)' \
'--config-file=[Provide a custom lsd configuration file]:config-file: ' \
'*--depth=[Stop recursing into directories after reaching specified depth]:num: ' \
'*--permission=[How to display permissions]: :(rwx octal)' \
'*--size=[How to display size]: :(default short bytes)' \
'*--date=[How to display date \[possible values: date, relative, +date-time-format\]]: : ' \
'*--sort=[sort by WORD instead of name]:WORD:(size time version extension none)' \
'*--group-dirs=[Sort the directories then the files]: :(none first last)' \
'*--blocks=[Specify the blocks that will be displayed and in what order]: :(permission user group context size date name inode links)' \
'*-I+[Do not display files/directories with names matching the glob pattern(s). More than one can be specified by repeating the argument]:pattern: ' \
'*--ignore-glob=[Do not display files/directories with names matching the glob pattern(s). More than one can be specified by repeating the argument]:pattern: ' \
'*--hyperlink=[Attach hyperlink to filenames]: :(always auto never)' \
'--help[Print help information]' \
'-V[Print version information]' \
'--version[Print version information]' \
'*-a[Do not ignore entries starting with .]' \
'*--all[Do not ignore entries starting with .]' \
'*-A[Do not list implied . and ..]' \
'*--almost-all[Do not list implied . and ..]' \
'*-F[Append indicator (one of */=>@|) at the end of the file names]' \
'*--classify[Append indicator (one of */=>@|) at the end of the file names]' \
'*-l[Display extended file metadata as a table]' \
'*--long[Display extended file metadata as a table]' \
'--ignore-config[Ignore the configuration file]' \
'*-1[Display one entry per line]' \
'*--oneline[Display one entry per line]' \
'(--tree)*-R[Recurse into directories]' \
'(--tree)*--recursive[Recurse into directories]' \
'*-h[For ls compatibility purposes ONLY, currently set by default]' \
'*--human-readable[For ls compatibility purposes ONLY, currently set by default]' \
'(-R --recursive)*--tree[Recurse into directories and present the result as a tree]' \
'(--depth -R --recursive)-d[Display directories themselves, and not their contents (recursively when used with --tree)]' \
'(--depth -R --recursive)--directory-only[Display directories themselves, and not their contents (recursively when used with --tree)]' \
'*--total-size[Display the total size of directories]' \
'*-t[Sort by time modified]' \
'*--timesort[Sort by time modified]' \
'*-S[Sort by size]' \
'*--sizesort[Sort by size]' \
'*-X[Sort by file extension]' \
'*--extensionsort[Sort by file extension]' \
'*-v[Natural sort of (version) numbers within text]' \
'*--versionsort[Natural sort of (version) numbers within text]' \
'*-U[Do not sort. List entries in directory order]' \
'*--no-sort[Do not sort. List entries in directory order]' \
'*-r[Reverse the order of the sort]' \
'*--reverse[Reverse the order of the sort]' \
'--group-directories-first[Groups the directories at the top before the files. Same as --group-dirs=first]' \
'--classic[Enable classic mode (display output similar to ls)]' \
'*--no-symlink[Do not display symlink target]' \
'*-i[Display the index number of each file]' \
'*--inode[Display the index number of each file]' \
'*-L[When showing file information for a symbolic link, show information for the file the link references rather than for the link itself]' \
'*--dereference[When showing file information for a symbolic link, show information for the file the link references rather than for the link itself]' \
'-Z[Print security context (label) of each file]' \
'--context[Print security context (label) of each file]' \
'--header[Display block headers]' \
'*::FILE:_files' \
&& ret=0
}
(( $+functions[_lsd_commands] )) ||
_lsd_commands() {
local commands; commands=()
_describe -t commands 'lsd commands' commands "$@"
}
_lsd "$@"

View file

@ -0,0 +1,665 @@
#compdef rg
##
# zsh completion function for ripgrep
#
# Run ci/test-complete after building to ensure that the options supported by
# this function stay in synch with the `rg` binary.
#
# For convenience, a completion reference guide is included at the bottom of
# this file.
#
# Originally based on code from the zsh-users project — see copyright notice
# below.
_rg() {
local curcontext=$curcontext no='!' descr ret=1
local -a context line state state_descr args tmp suf
local -A opt_args
# ripgrep has many options which negate the effect of a more common one — for
# example, `--no-column` to negate `--column`, and `--messages` to negate
# `--no-messages`. There are so many of these, and they're so infrequently
# used, that some users will probably find it irritating if they're completed
# indiscriminately, so let's not do that unless either the current prefix
# matches one of those negation options or the user has the `complete-all`
# style set. Note that this prefix check has to be updated manually to account
# for all of the potential negation options listed below!
if
# We also want to list all of these options during testing
[[ $_RG_COMPLETE_LIST_ARGS == (1|t*|y*) ]] ||
# (--[imnp]* => --ignore*, --messages, --no-*, --pcre2-unicode)
[[ $PREFIX$SUFFIX == --[imnp]* ]] ||
zstyle -t ":completion:${curcontext}:" complete-all
then
no=
fi
# We make heavy use of argument groups here to prevent the option specs from
# growing unwieldy. These aren't supported in zsh <5.4, though, so we'll strip
# them out below if necessary. This makes the exclusions inaccurate on those
# older versions, but oh well — it's not that big a deal
args=(
+ '(exclusive)' # Misc. fully exclusive options
'(: * -)'{-h,--help}'[display help information]'
'(: * -)'{-V,--version}'[display version information]'
'(: * -)'--pcre2-version'[print the version of PCRE2 used by ripgrep, if available]'
+ '(buffered)' # buffering options
'--line-buffered[force line buffering]'
$no"--no-line-buffered[don't force line buffering]"
'--block-buffered[force block buffering]'
$no"--no-block-buffered[don't force block buffering]"
+ '(case)' # Case-sensitivity options
{-i,--ignore-case}'[search case-insensitively]'
{-s,--case-sensitive}'[search case-sensitively]'
{-S,--smart-case}'[search case-insensitively if pattern is all lowercase]'
+ '(context-a)' # Context (after) options
'(context-c)'{-A+,--after-context=}'[specify lines to show after each match]:number of lines'
+ '(context-b)' # Context (before) options
'(context-c)'{-B+,--before-context=}'[specify lines to show before each match]:number of lines'
+ '(context-c)' # Context (combined) options
'(context-a context-b)'{-C+,--context=}'[specify lines to show before and after each match]:number of lines'
+ '(column)' # Column options
'--column[show column numbers for matches]'
$no"--no-column[don't show column numbers for matches]"
+ '(count)' # Counting options
{-c,--count}'[only show count of matching lines for each file]'
'--count-matches[only show count of individual matches for each file]'
'--include-zero[include files with zero matches in summary]'
$no"--no-include-zero[don't include files with zero matches in summary]"
+ '(encoding)' # Encoding options
{-E+,--encoding=}'[specify text encoding of files to search]: :_rg_encodings'
$no'--no-encoding[use default text encoding]'
+ '(engine)' # Engine choice options
'--engine=[select which regex engine to use]:when:((
default\:"use default engine"
pcre2\:"identical to --pcre2"
auto\:"identical to --auto-hybrid-regex"
))'
+ file # File-input options
'(1)*'{-f+,--file=}'[specify file containing patterns to search for]: :_files'
+ '(file-match)' # Files with/without match options
'(stats)'{-l,--files-with-matches}'[only show names of files with matches]'
'(stats)--files-without-match[only show names of files without matches]'
+ '(file-name)' # File-name options
{-H,--with-filename}'[show file name for matches]'
{-I,--no-filename}"[don't show file name for matches]"
+ '(file-system)' # File system options
"--one-file-system[don't descend into directories on other file systems]"
$no'--no-one-file-system[descend into directories on other file systems]'
+ '(fixed)' # Fixed-string options
{-F,--fixed-strings}'[treat pattern as literal string instead of regular expression]'
$no"--no-fixed-strings[don't treat pattern as literal string]"
+ '(follow)' # Symlink-following options
{-L,--follow}'[follow symlinks]'
$no"--no-follow[don't follow symlinks]"
+ '(generate)' # Options for generating ancillary data
'--generate=[generate man page or completion scripts]:when:((
man\:"man page"
complete-bash\:"shell completions for bash"
complete-zsh\:"shell completions for zsh"
complete-fish\:"shell completions for fish"
complete-powershell\:"shell completions for PowerShell"
))'
+ glob # File-glob options
'*'{-g+,--glob=}'[include/exclude files matching specified glob]:glob'
'*--iglob=[include/exclude files matching specified case-insensitive glob]:glob'
+ '(glob-case-insensitive)' # File-glob case sensitivity options
'--glob-case-insensitive[treat -g/--glob patterns case insensitively]'
$no'--no-glob-case-insensitive[treat -g/--glob patterns case sensitively]'
+ '(heading)' # Heading options
'(pretty-vimgrep)--heading[show matches grouped by file name]'
"(pretty-vimgrep)--no-heading[don't show matches grouped by file name]"
+ '(hidden)' # Hidden-file options
{-.,--hidden}'[search hidden files and directories]'
$no"--no-hidden[don't search hidden files and directories]"
+ '(hybrid)' # hybrid regex options
'--auto-hybrid-regex[DEPRECATED: dynamically use PCRE2 if necessary]'
$no"--no-auto-hybrid-regex[DEPRECATED: don't dynamically use PCRE2 if necessary]"
+ '(ignore)' # Ignore-file options
"(--no-ignore-global --no-ignore-parent --no-ignore-vcs --no-ignore-dot)--no-ignore[don't respect ignore files]"
$no'(--ignore-global --ignore-parent --ignore-vcs --ignore-dot)--ignore[respect ignore files]'
+ '(ignore-file-case-insensitive)' # Ignore-file case sensitivity options
'--ignore-file-case-insensitive[process ignore files case insensitively]'
$no'--no-ignore-file-case-insensitive[process ignore files case sensitively]'
+ '(ignore-exclude)' # Local exclude (ignore)-file options
"--no-ignore-exclude[don't respect local exclude (ignore) files]"
$no'--ignore-exclude[respect local exclude (ignore) files]'
+ '(ignore-global)' # Global ignore-file options
"--no-ignore-global[don't respect global ignore files]"
$no'--ignore-global[respect global ignore files]'
+ '(ignore-parent)' # Parent ignore-file options
"--no-ignore-parent[don't respect ignore files in parent directories]"
$no'--ignore-parent[respect ignore files in parent directories]'
+ '(ignore-vcs)' # VCS ignore-file options
"--no-ignore-vcs[don't respect version control ignore files]"
$no'--ignore-vcs[respect version control ignore files]'
+ '(require-git)' # git specific settings
"--no-require-git[don't require git repository to respect gitignore rules]"
$no'--require-git[require git repository to respect gitignore rules]'
+ '(ignore-dot)' # .ignore options
"--no-ignore-dot[don't respect .ignore files]"
$no'--ignore-dot[respect .ignore files]'
+ '(ignore-files)' # custom global ignore file options
"--no-ignore-files[don't respect --ignore-file flags]"
$no'--ignore-files[respect --ignore-file files]'
+ '(json)' # JSON options
'--json[output results in JSON Lines format]'
$no"--no-json[don't output results in JSON Lines format]"
+ '(line-number)' # Line-number options
{-n,--line-number}'[show line numbers for matches]'
{-N,--no-line-number}"[don't show line numbers for matches]"
+ '(line-terminator)' # Line-terminator options
'--crlf[use CRLF as line terminator]'
$no"--no-crlf[don't use CRLF as line terminator]"
'(text)--null-data[use NUL as line terminator]'
+ '(max-columns-preview)' # max column preview options
'--max-columns-preview[show preview for long lines (with -M)]'
$no"--no-max-columns-preview[don't show preview for long lines (with -M)]"
+ '(max-depth)' # Directory-depth options
{-d,--max-depth}'[specify max number of directories to descend]:number of directories'
'--maxdepth=[alias for --max-depth]:number of directories'
'!--maxdepth=:number of directories'
+ '(messages)' # Error-message options
'(--no-ignore-messages)--no-messages[suppress some error messages]'
$no"--messages[don't suppress error messages affected by --no-messages]"
+ '(messages-ignore)' # Ignore-error message options
"--no-ignore-messages[don't show ignore-file parse error messages]"
$no'--ignore-messages[show ignore-file parse error messages]'
+ '(mmap)' # mmap options
'--mmap[search using memory maps when possible]'
"--no-mmap[don't search using memory maps]"
+ '(multiline)' # Multiline options
{-U,--multiline}'[permit matching across multiple lines]'
$no'(multiline-dotall)--no-multiline[restrict matches to at most one line each]'
+ '(multiline-dotall)' # Multiline DOTALL options
'(--no-multiline)--multiline-dotall[allow "." to match newline (with -U)]'
$no"(--no-multiline)--no-multiline-dotall[don't allow \".\" to match newline (with -U)]"
+ '(only)' # Only-match options
{-o,--only-matching}'[show only matching part of each line]'
+ '(passthru)' # Pass-through options
'(--vimgrep)--passthru[show both matching and non-matching lines]'
'(--vimgrep)--passthrough[alias for --passthru]'
+ '(pcre2)' # PCRE2 options
{-P,--pcre2}'[enable matching with PCRE2]'
$no'(pcre2-unicode)--no-pcre2[disable matching with PCRE2]'
+ '(pcre2-unicode)' # PCRE2 Unicode options
$no'(--no-pcre2 --no-pcre2-unicode)--pcre2-unicode[DEPRECATED: enable PCRE2 Unicode mode (with -P)]'
'(--no-pcre2 --pcre2-unicode)--no-pcre2-unicode[DEPRECATED: disable PCRE2 Unicode mode (with -P)]'
+ '(pre)' # Preprocessing options
'(-z --search-zip)--pre=[specify preprocessor utility]:preprocessor utility:_command_names -e'
$no'--no-pre[disable preprocessor utility]'
+ pre-glob # Preprocessing glob options
'*--pre-glob[include/exclude files for preprocessing with --pre]'
+ '(pretty-vimgrep)' # Pretty/vimgrep display options
'(heading)'{-p,--pretty}'[alias for --color=always --heading -n]'
'(heading passthru)--vimgrep[show results in vim-compatible format]'
+ regexp # Explicit pattern options
'(1 file)*'{-e+,--regexp=}'[specify pattern]:pattern'
+ '(replace)' # Replacement options
{-r+,--replace=}'[specify string used to replace matches]:replace string'
+ '(sort)' # File-sorting options
'(threads)--sort=[sort results in ascending order (disables parallelism)]:sort method:((
none\:"no sorting"
path\:"sort by file path"
modified\:"sort by last modified time"
accessed\:"sort by last accessed time"
created\:"sort by creation time"
))'
'(threads)--sortr=[sort results in descending order (disables parallelism)]:sort method:((
none\:"no sorting"
path\:"sort by file path"
modified\:"sort by last modified time"
accessed\:"sort by last accessed time"
created\:"sort by creation time"
))'
'(threads)--sort-files[DEPRECATED: sort results by file path (disables parallelism)]'
$no"--no-sort-files[DEPRECATED: do not sort results]"
+ '(stats)' # Statistics options
'(--files file-match)--stats[show search statistics]'
$no"--no-stats[don't show search statistics]"
+ '(text)' # Binary-search options
{-a,--text}'[search binary files as if they were text]'
"--binary[search binary files, don't print binary data]"
$no"--no-binary[don't search binary files]"
$no"(--null-data)--no-text[don't search binary files as if they were text]"
+ '(threads)' # Thread-count options
'(sort)'{-j+,--threads=}'[specify approximate number of threads to use]:number of threads'
+ '(trim)' # Trim options
'--trim[trim any ASCII whitespace prefix from each line]'
$no"--no-trim[don't trim ASCII whitespace prefix from each line]"
+ type # Type options
'*'{-t+,--type=}'[only search files matching specified type]: :_rg_types'
'*--type-add=[add new glob for specified file type]: :->typespec'
'*--type-clear=[clear globs previously defined for specified file type]: :_rg_types'
# This should actually be exclusive with everything but other type options
'(: *)--type-list[show all supported file types and their associated globs]'
'*'{-T+,--type-not=}"[don't search files matching specified file type]: :_rg_types"
+ '(word-line)' # Whole-word/line match options
{-w,--word-regexp}'[only show matches surrounded by word boundaries]'
{-x,--line-regexp}'[only show matches surrounded by line boundaries]'
+ '(unicode)' # Unicode options
$no'--unicode[enable Unicode mode]'
'--no-unicode[disable Unicode mode]'
+ '(zip)' # Compression options
'(--pre)'{-z,--search-zip}'[search in compressed files]'
$no"--no-search-zip[don't search in compressed files]"
+ misc # Other options — no need to separate these at the moment
'(-b --byte-offset)'{-b,--byte-offset}'[show 0-based byte offset for each matching line]'
$no"--no-byte-offset[don't show byte offsets for each matching line]"
'--color=[specify when to use colors in output]:when:((
never\:"never use colors"
auto\:"use colors or not based on stdout, TERM, etc."
always\:"always use colors"
ansi\:"always use ANSI colors (even on Windows)"
))'
'*--colors=[specify color and style settings]: :->colorspec'
'--context-separator=[specify string used to separate non-continuous context lines in output]:separator'
$no"--no-context-separator[don't print context separators]"
'--debug[show debug messages]'
'--field-context-separator[set string to delimit fields in context lines]'
'--field-match-separator[set string to delimit fields in matching lines]'
'--hostname-bin=[executable for getting system hostname]:hostname executable:_command_names -e'
'--hyperlink-format=[specify pattern for hyperlinks]:pattern'
'--trace[show more verbose debug messages]'
'--dfa-size-limit=[specify upper size limit of generated DFA]:DFA size (bytes)'
"(1 stats)--files[show each file that would be searched (but don't search)]"
'*--ignore-file=[specify additional ignore file]:ignore file:_files'
'(-v --invert-match)'{-v,--invert-match}'[invert matching]'
$no"--no-invert-match[do not invert matching]"
'(-M --max-columns)'{-M+,--max-columns=}'[specify max length of lines to print]:number of bytes'
'(-m --max-count)'{-m+,--max-count=}'[specify max number of matches per file]:number of matches'
'--max-filesize=[specify size above which files should be ignored]:file size (bytes)'
"--no-config[don't load configuration files]"
'(-0 --null)'{-0,--null}'[print NUL byte after file names]'
'--path-separator=[specify path separator to use when printing file names]:separator'
'(-q --quiet)'{-q,--quiet}'[suppress normal output]'
'--regex-size-limit=[specify upper size limit of compiled regex]:regex size (bytes)'
'*'{-u,--unrestricted}'[reduce level of "smart" searching]'
'--stop-on-nonmatch[stop on first non-matching line after a matching one]'
+ operand # Operands
'(--files --type-list file regexp)1: :_guard "^-*" pattern'
'(--type-list)*: :_files'
)
# This is used with test-complete to verify that there are no options
# listed in the help output that aren't also defined here
[[ $_RG_COMPLETE_LIST_ARGS == (1|t*|y*) ]] && {
print -rl - $args
return 0
}
# Strip out argument groups where unsupported (see above)
[[ $ZSH_VERSION == (4|5.<0-3>)(.*)# ]] &&
args=( ${(@)args:#(#i)(+|[a-z0-9][a-z0-9_-]#|\([a-z0-9][a-z0-9_-]#\))} )
_arguments -C -s -S : $args && ret=0
case $state in
colorspec)
if [[ ${IPREFIX#--*=}$PREFIX == [^:]# ]]; then
suf=( -qS: )
tmp=(
'column:specify coloring for column numbers'
'line:specify coloring for line numbers'
'match:specify coloring for match text'
'path:specify coloring for file names'
)
descr='color/style type'
elif [[ ${IPREFIX#--*=}$PREFIX == (column|line|match|path):[^:]# ]]; then
suf=( -qS: )
tmp=(
'none:clear color/style for type'
'bg:specify background color'
'fg:specify foreground color'
'style:specify text style'
)
descr='color/style attribute'
elif [[ ${IPREFIX#--*=}$PREFIX == [^:]##:(bg|fg):[^:]# ]]; then
tmp=( black blue green red cyan magenta yellow white )
descr='color name or r,g,b'
elif [[ ${IPREFIX#--*=}$PREFIX == [^:]##:style:[^:]# ]]; then
tmp=( {,no}bold {,no}intense {,no}underline )
descr='style name'
else
_message -e colorspec 'no more arguments'
fi
(( $#tmp )) && {
compset -P '*:'
_describe -t colorspec $descr tmp $suf && ret=0
}
;;
typespec)
if compset -P '[^:]##:include:'; then
_sequence -s , _rg_types && ret=0
# @todo This bit in particular could be better, but it's a little
# complex, and attempting to solve it seems to run us up against a crash
# bug — zsh # 40362
elif compset -P '[^:]##:'; then
_message 'glob or include directive' && ret=1
elif [[ ! -prefix *:* ]]; then
_rg_types -qS : && ret=0
fi
;;
esac
return ret
}
# Complete encodings
_rg_encodings() {
local -a expl
local -aU _encodings
_encodings=(
# This is impossible to read, but these encodings rarely if ever change, so
# it probably does not matter. They are derived from the list given here:
# https://encoding.spec.whatwg.org/#concept-encoding-get
#
# The globbing here works in both fish and zsh (though they expand it in
# different orders). It may work in other shells too.
{{,us-}ascii,arabic,chinese,cyrillic,greek{,8},hebrew,korean}
logical visual mac {,cs}macintosh x-mac-{cyrillic,roman,ukrainian}
866 ibm{819,866} csibm866
big5{,-hkscs} {cn-,cs}big5 x-x-big5
cp{819,866,125{0,1,2,3,4,5,6,7,8}} x-cp125{0,1,2,3,4,5,6,7,8}
csiso2022{jp,kr} csiso8859{6,8}{e,i}
csisolatin{1,2,3,4,5,6,9} csisolatin{arabic,cyrillic,greek,hebrew}
ecma-{114,118} asmo-708 elot_928 sun_eu_greek
euc-{jp,kr} x-euc-jp cseuckr cseucpkdfmtjapanese
{,x-}gbk csiso58gb231280 gb18030 {,cs}gb2312 gb_2312{,-80} hz-gb-2312
iso-2022-{cn,cn-ext,jp,kr}
iso8859{,-}{1,2,3,4,5,6,7,8,9,10,11,13,14,15}
iso-8859-{1,2,3,4,5,6,7,8,9,10,11,{6,8}-{e,i},13,14,15,16} iso_8859-{1,2,3,4,5,6,7,8,9,15}
iso_8859-{1,2,6,7}:1987 iso_8859-{3,4,5,8}:1988 iso_8859-9:1989
iso-ir-{58,100,101,109,110,126,127,138,144,148,149,157}
koi{,8,8-r,8-ru,8-u,8_r} cskoi8r
ks_c_5601-{1987,1989} ksc{,_}5691 csksc56011987
latin{1,2,3,4,5,6} l{1,2,3,4,5,6,9}
shift{-,_}jis csshiftjis {,x-}sjis ms_kanji ms932
utf{,-}8 utf-16{,be,le} unicode-1-1-utf-8
windows-{31j,874,949,125{0,1,2,3,4,5,6,7,8}} dos-874 tis-620 ansi_x3.4-1968
x-user-defined auto none
)
_wanted encodings expl encoding compadd -a "$@" - _encodings
}
# Complete file types
_rg_types() {
local -a expl
local -aU _types
_types=( ${(@)${(f)"$( _call_program types $words[1] --type-list )"}//:[[:space:]]##/:} )
if zstyle -t ":completion:${curcontext}:types" extra-verbose; then
_describe -t types 'file type' _types
else
_wanted types expl 'file type' compadd "$@" - ${(@)_types%%:*}
fi
}
_rg "$@"
################################################################################
# ZSH COMPLETION REFERENCE
#
# For the convenience of developers who aren't especially familiar with zsh
# completion functions, a brief reference guide follows. This is in no way
# comprehensive; it covers just enough of the basic structure, syntax, and
# conventions to help someone make simple changes like adding new options. For
# more complete documentation regarding zsh completion functions, please see the
# following:
#
# * http://zsh.sourceforge.net/Doc/Release/Completion-System.html
# * https://github.com/zsh-users/zsh/blob/master/Etc/completion-style-guide
#
# OVERVIEW
#
# Most zsh completion functions are defined in terms of `_arguments`, which is a
# shell function that takes a series of argument specifications. The specs for
# `rg` are stored in an array, which is common for more complex functions; the
# elements of the array are passed to `_arguments` on invocation.
#
# ARGUMENT-SPECIFICATION SYNTAX
#
# The following is a contrived example of the argument specs for a simple tool:
#
# '(: * -)'{-h,--help}'[display help information]'
# '(-q -v --quiet --verbose)'{-q,--quiet}'[decrease output verbosity]'
# '!(-q -v --quiet --verbose)--silent'
# '(-q -v --quiet --verbose)'{-v,--verbose}'[increase output verbosity]'
# '--color=[specify when to use colors]:when:(always never auto)'
# '*:example file:_files'
#
# Although there may appear to be six specs here, there are actually nine; we
# use brace expansion to combine specs for options that go by multiple names,
# like `-q` and `--quiet`. This is customary, and ties in with the fact that zsh
# merges completion possibilities together when they have the same description.
#
# The first line defines the option `-h`/`--help`. With most tools, it isn't
# useful to complete anything after `--help` because it effectively overrides
# all others; the `(: * -)` at the beginning of the spec tells zsh not to
# complete any other operands (`:` and `*`) or options (`-`) after this one has
# been used. The `[...]` at the end associates a description with `-h`/`--help`;
# as mentioned, zsh will see the identical descriptions and merge these options
# together when offering completion possibilities.
#
# The next line defines `-q`/`--quiet`. Here we don't want to suppress further
# completions entirely, but we don't want to offer `-q` if `--quiet` has been
# given (since they do the same thing), nor do we want to offer `-v` (since it
# doesn't make sense to be quiet and verbose at the same time). We don't need to
# tell zsh not to offer `--quiet` a second time, since that's the default
# behaviour, but since this line expands to two specs describing `-q` *and*
# `--quiet` we do need to explicitly list all of them here.
#
# The next line defines a hidden option `--silent` — maybe it's a deprecated
# synonym for `--quiet`. The leading `!` indicates that zsh shouldn't offer this
# option during completion. The benefit of providing a spec for an option that
# shouldn't be completed is that, if someone *does* use it, we can correctly
# suppress completion of other options afterwards.
#
# The next line defines `-v`/`--verbose`; this works just like `-q`/`--quiet`.
#
# The next line defines `--color`. In this example, `--color` doesn't have a
# corresponding short option, so we don't need to use brace expansion. Further,
# there are no other options it's exclusive with (just itself), so we don't need
# to define those at the beginning. However, it does take a mandatory argument.
# The `=` at the end of `--color=` indicates that the argument may appear either
# like `--color always` or like `--color=always`; this is how most GNU-style
# command-line tools work. The corresponding short option would normally use `+`
# — for example, `-c+` would allow either `-c always` or `-calways`. For this
# option, the arguments are known ahead of time, so we can simply list them in
# parentheses at the end (`when` is used as the description for the argument).
#
# The last line defines an operand (a non-option argument). In this example, the
# operand can be used any number of times (the leading `*`), and it should be a
# file path, so we tell zsh to call the `_files` function to complete it. The
# `example file` in the middle is the description to use for this operand; we
# could use a space instead to accept the default provided by `_files`.
#
# GROUPING ARGUMENT SPECIFICATIONS
#
# Newer versions of zsh support grouping argument specs together. All specs
# following a `+` and then a group name are considered to be members of the
# named group. Grouping is useful mostly for organisational purposes; it makes
# the relationship between different options more obvious, and makes it easier
# to specify exclusions.
#
# We could rewrite our example above using grouping as follows:
#
# '(: * -)'{-h,--help}'[display help information]'
# '--color=[specify when to use colors]:when:(always never auto)'
# '*:example file:_files'
# + '(verbosity)'
# {-q,--quiet}'[decrease output verbosity]'
# '!--silent'
# {-v,--verbose}'[increase output verbosity]'
#
# Here we take advantage of a useful feature of spec grouping — when the group
# name is surrounded by parentheses, as in `(verbosity)`, it tells zsh that all
# of the options in that group are exclusive with each other. As a result, we
# don't need to manually list out the exclusions at the beginning of each
# option.
#
# Groups can also be referred to by name in other argument specs; for example:
#
# '(xyz)--aaa' '*: :_files'
# + xyz --xxx --yyy --zzz
#
# Here we use the group name `xyz` to tell zsh that `--xxx`, `--yyy`, and
# `--zzz` are not to be completed after `--aaa`. This makes the exclusion list
# much more compact and reusable.
#
# CONVENTIONS
#
# zsh completion functions generally adhere to the following conventions:
#
# * Use two spaces for indentation
# * Combine specs for options with different names using brace expansion
# * In combined specs, list the short option first (as in `{-a,--text}`)
# * Use `+` or `=` as described above for options that take arguments
# * Provide a description for all options, option-arguments, and operands
# * Capitalise/punctuate argument descriptions as phrases, not complete
# sentences — 'display help information', never 'Display help information.'
# (but still capitalise acronyms and proper names)
# * Write argument descriptions as verb phrases — 'display x', 'enable y',
# 'use z'
# * Word descriptions to make it clear when an option expects an argument;
# usually this is done with the word 'specify', as in 'specify x' or
# 'use specified x')
# * Write argument descriptions as tersely as possible — for example, articles
# like 'a' and 'the' should be omitted unless it would be confusing
#
# Other conventions currently used by this function:
#
# * Order argument specs alphabetically by group name, then option name
# * Group options that are directly related, mutually exclusive, or frequently
# referenced by other argument specs
# * Use only characters in the set [a-z0-9_-] in group names
# * Order exclusion lists as follows: short options, long options, groups
# * Use American English in descriptions
# * Use 'don't' in descriptions instead of 'do not'
# * Word descriptions for related options as similarly as possible. For example,
# `--foo[enable foo]` and `--no-foo[disable foo]`, or `--foo[use foo]` and
# `--no-foo[don't use foo]`
# * Word descriptions to make it clear when an option only makes sense with
# another option, usually by adding '(with -x)' to the end
# * Don't quote strings or variables unnecessarily. When quotes are required,
# prefer single-quotes to double-quotes
# * Prefix option specs with `$no` when the option serves only to negate the
# behaviour of another option that must be provided explicitly by the user.
# This prevents rarely used options from cluttering up the completion menu
################################################################################
# ------------------------------------------------------------------------------
# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the zsh-users nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for ripgrep
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * arcizan <ghostrevery@gmail.com>
# * MaskRay <i@maskray.me>
#
# ------------------------------------------------------------------------------
# Local Variables:
# mode: shell-script
# coding: utf-8-unix
# indent-tabs-mode: nil
# sh-indentation: 2
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,440 @@
#compdef starship
autoload -U is-at-least
_starship() {
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[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
'-V[Print version information]' \
'--version[Print version information]' \
":: :_starship_commands" \
"*::: :->starship" \
&& ret=0
case $state in
(starship)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:starship-command-$line[1]:"
case $line[1] in
(bug-report)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(completions)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
':shell:(bash elvish fish powershell zsh)' \
&& ret=0
;;
(config)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
'::name -- Configuration key to edit:' \
'::value -- Value to place into that key:' \
&& ret=0
;;
(explain)
_arguments "${_arguments_options[@]}" \
'-s+[The status code of the previously run command as an unsigned or signed 32bit integer]:STATUS_CODE: ' \
'--status=[The status code of the previously run command as an unsigned or signed 32bit integer]:STATUS_CODE: ' \
'*--pipestatus=[Bash, Fish and Zsh support returning codes for each process in a pipeline]:PIPESTATUS: ' \
'-w+[The width of the current interactive terminal]:TERMINAL_WIDTH: ' \
'--terminal-width=[The width of the current interactive terminal]:TERMINAL_WIDTH: ' \
'-p+[The path that the prompt should render for]:PATH:_files' \
'--path=[The path that the prompt should render for]:PATH:_files' \
'-P+[The logical path that the prompt should render for. This path should be a virtual/logical representation of the PATH argument]:LOGICAL_PATH:_files' \
'--logical-path=[The logical path that the prompt should render for. This path should be a virtual/logical representation of the PATH argument]:LOGICAL_PATH:_files' \
'-d+[The execution duration of the last command, in milliseconds]:CMD_DURATION: ' \
'--cmd-duration=[The execution duration of the last command, in milliseconds]:CMD_DURATION: ' \
'-k+[The keymap of fish/zsh/cmd]:KEYMAP: ' \
'--keymap=[The keymap of fish/zsh/cmd]:KEYMAP: ' \
'-j+[The number of currently running jobs]:JOBS: ' \
'--jobs=[The number of currently running jobs]:JOBS: ' \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(init)
_arguments "${_arguments_options[@]}" \
'--print-full-init[]' \
'-h[Print help information]' \
'--help[Print help information]' \
':shell:' \
&& ret=0
;;
(module)
_arguments "${_arguments_options[@]}" \
'-s+[The status code of the previously run command as an unsigned or signed 32bit integer]:STATUS_CODE: ' \
'--status=[The status code of the previously run command as an unsigned or signed 32bit integer]:STATUS_CODE: ' \
'*--pipestatus=[Bash, Fish and Zsh support returning codes for each process in a pipeline]:PIPESTATUS: ' \
'-w+[The width of the current interactive terminal]:TERMINAL_WIDTH: ' \
'--terminal-width=[The width of the current interactive terminal]:TERMINAL_WIDTH: ' \
'-p+[The path that the prompt should render for]:PATH:_files' \
'--path=[The path that the prompt should render for]:PATH:_files' \
'-P+[The logical path that the prompt should render for. This path should be a virtual/logical representation of the PATH argument]:LOGICAL_PATH:_files' \
'--logical-path=[The logical path that the prompt should render for. This path should be a virtual/logical representation of the PATH argument]:LOGICAL_PATH:_files' \
'-d+[The execution duration of the last command, in milliseconds]:CMD_DURATION: ' \
'--cmd-duration=[The execution duration of the last command, in milliseconds]:CMD_DURATION: ' \
'-k+[The keymap of fish/zsh/cmd]:KEYMAP: ' \
'--keymap=[The keymap of fish/zsh/cmd]:KEYMAP: ' \
'-j+[The number of currently running jobs]:JOBS: ' \
'--jobs=[The number of currently running jobs]:JOBS: ' \
'-l[List out all supported modules]' \
'--list[List out all supported modules]' \
'-h[Print help information]' \
'--help[Print help information]' \
'::name -- The name of the module to be printed:' \
&& ret=0
;;
(preset)
_arguments "${_arguments_options[@]}" \
'-l[List out all preset names]' \
'--list[List out all preset names]' \
'-h[Print help information]' \
'--help[Print help information]' \
'::name -- The name of preset to be printed:(bracketed-segments nerd-font-symbols no-empty-icons no-nerd-font no-runtime-versions pastel-powerline plain-text-symbols pure-preset tokyo-night)' \
&& ret=0
;;
(print-config)
_arguments "${_arguments_options[@]}" \
'-d[Print the default instead of the computed config]' \
'--default[Print the default instead of the computed config]' \
'-h[Print help information]' \
'--help[Print help information]' \
'*::name -- Configuration keys to print:' \
&& ret=0
;;
(prompt)
_arguments "${_arguments_options[@]}" \
'-s+[The status code of the previously run command as an unsigned or signed 32bit integer]:STATUS_CODE: ' \
'--status=[The status code of the previously run command as an unsigned or signed 32bit integer]:STATUS_CODE: ' \
'*--pipestatus=[Bash, Fish and Zsh support returning codes for each process in a pipeline]:PIPESTATUS: ' \
'-w+[The width of the current interactive terminal]:TERMINAL_WIDTH: ' \
'--terminal-width=[The width of the current interactive terminal]:TERMINAL_WIDTH: ' \
'-p+[The path that the prompt should render for]:PATH:_files' \
'--path=[The path that the prompt should render for]:PATH:_files' \
'-P+[The logical path that the prompt should render for. This path should be a virtual/logical representation of the PATH argument]:LOGICAL_PATH:_files' \
'--logical-path=[The logical path that the prompt should render for. This path should be a virtual/logical representation of the PATH argument]:LOGICAL_PATH:_files' \
'-d+[The execution duration of the last command, in milliseconds]:CMD_DURATION: ' \
'--cmd-duration=[The execution duration of the last command, in milliseconds]:CMD_DURATION: ' \
'-k+[The keymap of fish/zsh/cmd]:KEYMAP: ' \
'--keymap=[The keymap of fish/zsh/cmd]:KEYMAP: ' \
'-j+[The number of currently running jobs]:JOBS: ' \
'--jobs=[The number of currently running jobs]:JOBS: ' \
'--right[Print the right prompt (instead of the standard left prompt)]' \
'(--right)--continuation[Print the continuation prompt (instead of the standard left prompt)]' \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(session)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(time)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(timings)
_arguments "${_arguments_options[@]}" \
'-s+[The status code of the previously run command as an unsigned or signed 32bit integer]:STATUS_CODE: ' \
'--status=[The status code of the previously run command as an unsigned or signed 32bit integer]:STATUS_CODE: ' \
'*--pipestatus=[Bash, Fish and Zsh support returning codes for each process in a pipeline]:PIPESTATUS: ' \
'-w+[The width of the current interactive terminal]:TERMINAL_WIDTH: ' \
'--terminal-width=[The width of the current interactive terminal]:TERMINAL_WIDTH: ' \
'-p+[The path that the prompt should render for]:PATH:_files' \
'--path=[The path that the prompt should render for]:PATH:_files' \
'-P+[The logical path that the prompt should render for. This path should be a virtual/logical representation of the PATH argument]:LOGICAL_PATH:_files' \
'--logical-path=[The logical path that the prompt should render for. This path should be a virtual/logical representation of the PATH argument]:LOGICAL_PATH:_files' \
'-d+[The execution duration of the last command, in milliseconds]:CMD_DURATION: ' \
'--cmd-duration=[The execution duration of the last command, in milliseconds]:CMD_DURATION: ' \
'-k+[The keymap of fish/zsh/cmd]:KEYMAP: ' \
'--keymap=[The keymap of fish/zsh/cmd]:KEYMAP: ' \
'-j+[The number of currently running jobs]:JOBS: ' \
'--jobs=[The number of currently running jobs]:JOBS: ' \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(toggle)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
':name -- The name of the module to be toggled:' \
'::value -- The key of the config to be toggled:' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
":: :_starship__help_commands" \
"*::: :->help" \
&& ret=0
case $state in
(help)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:starship-help-command-$line[1]:"
case $line[1] in
(bug-report)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(completions)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(config)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(explain)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(init)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(module)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(preset)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(print-config)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(prompt)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(session)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(time)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(timings)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(toggle)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
esac
;;
esac
;;
esac
;;
esac
}
(( $+functions[_starship_commands] )) ||
_starship_commands() {
local commands; commands=(
'bug-report:Create a pre-populated GitHub issue with information about your configuration' \
'completions:Generate starship shell completions for your shell to stdout' \
'config:Edit the starship configuration' \
'explain:Explains the currently showing modules' \
'init:Prints the shell function used to execute starship' \
'module:Prints a specific prompt module' \
'preset:Prints a preset config' \
'print-config:Prints the computed starship configuration' \
'prompt:Prints the full starship prompt' \
'session:Generate random session key' \
'time:Prints time in milliseconds' \
'timings:Prints timings of all active modules' \
'toggle:Toggle a given starship module' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'starship commands' commands "$@"
}
(( $+functions[_starship__bug-report_commands] )) ||
_starship__bug-report_commands() {
local commands; commands=()
_describe -t commands 'starship bug-report commands' commands "$@"
}
(( $+functions[_starship__help__bug-report_commands] )) ||
_starship__help__bug-report_commands() {
local commands; commands=()
_describe -t commands 'starship help bug-report commands' commands "$@"
}
(( $+functions[_starship__completions_commands] )) ||
_starship__completions_commands() {
local commands; commands=()
_describe -t commands 'starship completions commands' commands "$@"
}
(( $+functions[_starship__help__completions_commands] )) ||
_starship__help__completions_commands() {
local commands; commands=()
_describe -t commands 'starship help completions commands' commands "$@"
}
(( $+functions[_starship__config_commands] )) ||
_starship__config_commands() {
local commands; commands=()
_describe -t commands 'starship config commands' commands "$@"
}
(( $+functions[_starship__help__config_commands] )) ||
_starship__help__config_commands() {
local commands; commands=()
_describe -t commands 'starship help config commands' commands "$@"
}
(( $+functions[_starship__explain_commands] )) ||
_starship__explain_commands() {
local commands; commands=()
_describe -t commands 'starship explain commands' commands "$@"
}
(( $+functions[_starship__help__explain_commands] )) ||
_starship__help__explain_commands() {
local commands; commands=()
_describe -t commands 'starship help explain commands' commands "$@"
}
(( $+functions[_starship__help_commands] )) ||
_starship__help_commands() {
local commands; commands=(
'bug-report:Create a pre-populated GitHub issue with information about your configuration' \
'completions:Generate starship shell completions for your shell to stdout' \
'config:Edit the starship configuration' \
'explain:Explains the currently showing modules' \
'init:Prints the shell function used to execute starship' \
'module:Prints a specific prompt module' \
'preset:Prints a preset config' \
'print-config:Prints the computed starship configuration' \
'prompt:Prints the full starship prompt' \
'session:Generate random session key' \
'time:Prints time in milliseconds' \
'timings:Prints timings of all active modules' \
'toggle:Toggle a given starship module' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'starship help commands' commands "$@"
}
(( $+functions[_starship__help__help_commands] )) ||
_starship__help__help_commands() {
local commands; commands=()
_describe -t commands 'starship help help commands' commands "$@"
}
(( $+functions[_starship__help__init_commands] )) ||
_starship__help__init_commands() {
local commands; commands=()
_describe -t commands 'starship help init commands' commands "$@"
}
(( $+functions[_starship__init_commands] )) ||
_starship__init_commands() {
local commands; commands=()
_describe -t commands 'starship init commands' commands "$@"
}
(( $+functions[_starship__help__module_commands] )) ||
_starship__help__module_commands() {
local commands; commands=()
_describe -t commands 'starship help module commands' commands "$@"
}
(( $+functions[_starship__module_commands] )) ||
_starship__module_commands() {
local commands; commands=()
_describe -t commands 'starship module commands' commands "$@"
}
(( $+functions[_starship__help__preset_commands] )) ||
_starship__help__preset_commands() {
local commands; commands=()
_describe -t commands 'starship help preset commands' commands "$@"
}
(( $+functions[_starship__preset_commands] )) ||
_starship__preset_commands() {
local commands; commands=()
_describe -t commands 'starship preset commands' commands "$@"
}
(( $+functions[_starship__help__print-config_commands] )) ||
_starship__help__print-config_commands() {
local commands; commands=()
_describe -t commands 'starship help print-config commands' commands "$@"
}
(( $+functions[_starship__print-config_commands] )) ||
_starship__print-config_commands() {
local commands; commands=()
_describe -t commands 'starship print-config commands' commands "$@"
}
(( $+functions[_starship__help__prompt_commands] )) ||
_starship__help__prompt_commands() {
local commands; commands=()
_describe -t commands 'starship help prompt commands' commands "$@"
}
(( $+functions[_starship__prompt_commands] )) ||
_starship__prompt_commands() {
local commands; commands=()
_describe -t commands 'starship prompt commands' commands "$@"
}
(( $+functions[_starship__help__session_commands] )) ||
_starship__help__session_commands() {
local commands; commands=()
_describe -t commands 'starship help session commands' commands "$@"
}
(( $+functions[_starship__session_commands] )) ||
_starship__session_commands() {
local commands; commands=()
_describe -t commands 'starship session commands' commands "$@"
}
(( $+functions[_starship__help__time_commands] )) ||
_starship__help__time_commands() {
local commands; commands=()
_describe -t commands 'starship help time commands' commands "$@"
}
(( $+functions[_starship__time_commands] )) ||
_starship__time_commands() {
local commands; commands=()
_describe -t commands 'starship time commands' commands "$@"
}
(( $+functions[_starship__help__timings_commands] )) ||
_starship__help__timings_commands() {
local commands; commands=()
_describe -t commands 'starship help timings commands' commands "$@"
}
(( $+functions[_starship__timings_commands] )) ||
_starship__timings_commands() {
local commands; commands=()
_describe -t commands 'starship timings commands' commands "$@"
}
(( $+functions[_starship__help__toggle_commands] )) ||
_starship__help__toggle_commands() {
local commands; commands=()
_describe -t commands 'starship help toggle commands' commands "$@"
}
(( $+functions[_starship__toggle_commands] )) ||
_starship__toggle_commands() {
local commands; commands=()
_describe -t commands 'starship toggle commands' commands "$@"
}
_starship "$@"

View file

@ -0,0 +1,26 @@
#compdef $PROG
PROG=tea
_CLI_ZSH_AUTOCOMPLETE_HACK=1
_cli_zsh_autocomplete() {
local -a opts
local cur
cur=${words[-1]}
if [[ "$cur" == "-"* ]]; then
opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} ${cur} --generate-bash-completion)}")
else
opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} --generate-bash-completion)}")
fi
if [[ "${opts[1]}" != "" ]]; then
_describe 'values' opts
else
_files
fi
return
}
compdef _cli_zsh_autocomplete $PROG

View file

@ -0,0 +1,47 @@
#compdef tldr
_applications() {
local -a commands
commands=(${(uonzf)"$(tldr --list 2>/dev/null)"//:/\\:})
_describe -t commands 'command' commands
}
_tealdeer() {
local I="-h --help -v --version"
integer ret=1
local -a args
args+=(
"($I -l --list)"{-l,--list}"[List all commands in the cache]"
"($I -f --render)"{-f,--render}"[Render a specific markdown file]:file:_files"
"($I -p --platform)"{-p,--platform}'[Override the operating system]:platform:((
linux
macos
sunos
windows
android
))'
"($I -L --language)"{-L,--language}"[Override the language settings]:lang"
"($I -u --update)"{-u,--update}"[Update the local cache]"
"($I)--no-auto-update[If auto update is configured, disable it for this run]"
"($I -c --clear-cache)"{-c,--clear-cache}"[Clear the local cache]"
"($I)--pager[Use a pager to page output]"
"($I -r --raw)"{-r,--raw}"[Display the raw markdown instead of rendering it]"
"($I -q --quiet)"{-q,--quiet}"[Suppress informational messages]"
"($I)--show-paths[Show file and directory paths used by tealdeer]"
"($I)--seed-config[Create a basic config]"
"($I)--color[Controls when to use color]:when:((
always
auto
never
))"
'(- *)'{-h,--help}'[Display help]'
'(- *)'{-v,--version}'[Show version information]'
'1: :_applications'
)
_arguments $args[@] && ret=0
return ret
}
_tealdeer

View file

@ -0,0 +1,937 @@
#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[@]}" \
'*--max-panes=[Maximum panes on screen, caution: opening more panes will close old ones]:MAX_PANES: ' \
'*--data-dir=[Change where zellij looks for plugins]:DATA_DIR:_files' \
'*--server=[Run server listening at the specified socket path]:SERVER:_files' \
'*-s+[Specify name of a new session]:SESSION: ' \
'*--session=[Specify name of a new session]:SESSION: ' \
'*-l+[Name of a predefined layout inside the layout directory or the path to a layout file]:LAYOUT:_files' \
'*--layout=[Name of a predefined layout inside the layout directory or the path to a layout file]:LAYOUT:_files' \
'*-c+[Change where zellij looks for the configuration file]:CONFIG:_files' \
'*--config=[Change where zellij looks for the configuration file]:CONFIG:_files' \
'*--config-dir=[Change where zellij looks for the configuration directory]:CONFIG_DIR:_files' \
'-h[Print help information]' \
'--help[Print help information]' \
'-V[Print version information]' \
'--version[Print version information]' \
'*-d[Specify emitting additional debug information]' \
'*--debug[Specify emitting additional debug 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
(options)
_arguments "${_arguments_options[@]}" \
'*--simplified-ui=[Allow plugins to use a more simplified layout that is compatible with more fonts (true or false)]:SIMPLIFIED_UI:(true false)' \
'*--theme=[Set the default theme]:THEME: ' \
'*--default-mode=[Set the default mode]:DEFAULT_MODE:((normal\:"In `Normal` mode, input is always written to the terminal, except for the shortcuts leading to other modes"
locked\:"In `Locked` mode, input is always written to the terminal and all shortcuts are disabled except the one leading back to normal mode"
resize\:"`Resize` mode allows resizing the different existing panes"
pane\:"`Pane` mode allows creating and closing panes, as well as moving between them"
tab\:"`Tab` mode allows creating and closing tabs, as well as moving between them"
scroll\:"`Scroll` mode allows scrolling up and down within a pane"
enter-search\:"`EnterSearch` mode allows for typing in the needle for a search in the scroll buffer of a pane"
search\:"`Search` mode allows for searching a term in a pane (superset of `Scroll`)"
rename-tab\:"`RenameTab` mode allows assigning a new name to a tab"
rename-pane\:"`RenamePane` mode allows assigning a new name to a pane"
session\:"`Session` mode allows detaching sessions"
move\:"`Move` mode allows moving the different existing panes within a tab"
prompt\:"`Prompt` mode allows interacting with active prompts"
tmux\:"`Tmux` mode allows for basic tmux keybindings functionality"))' \
'*--default-shell=[Set the default shell]:DEFAULT_SHELL:_files' \
'*--default-layout=[Set the default layout]:DEFAULT_LAYOUT:_files' \
'*--layout-dir=[Set the layout_dir, defaults to subdirectory of config dir]:LAYOUT_DIR:_files' \
'*--theme-dir=[Set the theme_dir, defaults to subdirectory of config dir]:THEME_DIR:_files' \
'*--mouse-mode=[Set the handling of mouse events (true or false) Can be temporarily bypassed by the \[SHIFT\] key]:MOUSE_MODE:(true false)' \
'*--pane-frames=[Set display of the pane frames (true or false)]:PANE_FRAMES:(true false)' \
'*--mirror-session=[Mirror session when multiple users are connected (true or false)]:MIRROR_SESSION:(true false)' \
'*--on-force-close=[Set behaviour on force close (quit or detach)]:ON_FORCE_CLOSE:(quit detach)' \
'*--scroll-buffer-size=[]:SCROLL_BUFFER_SIZE: ' \
'*--copy-command=[Switch to using a user supplied command for clipboard instead of OSC52]:COPY_COMMAND: ' \
'(--copy-command)*--copy-clipboard=[OSC52 destination clipboard]:COPY_CLIPBOARD:(system primary)' \
'*--copy-on-select=[Automatically copy when selecting text (true or false)]:COPY_ON_SELECT:(true false)' \
'*--scrollback-editor=[Explicit full path to open the scrollback editor (default is $EDITOR or $VISUAL)]:SCROLLBACK_EDITOR:_files' \
'*--session-name=[The name of the session to create when starting Zellij]:SESSION_NAME: ' \
'*--attach-to-session=[Whether to attach to a session specified in "session-name" if it exists]:ATTACH_TO_SESSION:(true false)' \
'*--auto-layout=[Whether to lay out panes in a predefined set of layouts whenever possible]:AUTO_LAYOUT:(true false)' \
'(--mouse-mode)*--disable-mouse-mode[Disable handling of mouse events]' \
'(--pane-frames)*--no-pane-frames[Disable display of pane frames]' \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(setup)
_arguments "${_arguments_options[@]}" \
'*--dump-layout=[Dump the specified layout file to stdout]:DUMP_LAYOUT: ' \
'*--dump-swap-layout=[Dump the specified swap layout file to stdout]:DUMP_SWAP_LAYOUT: ' \
'*--dump-plugins=[Dump the builtin plugins to DIR or "DATA DIR" if unspecified]:DIR:_files' \
'*--generate-completion=[Generates completion for the specified shell]:SHELL: ' \
'*--generate-auto-start=[Generates auto-start script for the specified shell]:SHELL: ' \
'*--dump-config[Dump the default configuration file to stdout]' \
'*--clean[Disables loading of configuration file at default location, loads the defaults that zellij ships with]' \
'*--check[Checks the configuration of zellij and displays currently used directories]' \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(list-sessions)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(attach)
_arguments "${_arguments_options[@]}" \
'*--index=[Number of the session index in the active sessions ordered creation date]:INDEX: ' \
'*-c[Create a session if one does not exist]' \
'*--create[Create a session if one does not exist]' \
'-h[Print help information]' \
'--help[Print help information]' \
'::session-name -- Name of the session to attach to:' \
":: :_zellij__attach_commands" \
"*::: :->attach" \
&& ret=0
case $state in
(attach)
words=($line[2] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:zellij-attach-command-$line[2]:"
case $line[2] in
(options)
_arguments "${_arguments_options[@]}" \
'*--simplified-ui=[Allow plugins to use a more simplified layout that is compatible with more fonts (true or false)]:SIMPLIFIED_UI:(true false)' \
'*--theme=[Set the default theme]:THEME: ' \
'*--default-mode=[Set the default mode]:DEFAULT_MODE:((normal\:"In `Normal` mode, input is always written to the terminal, except for the shortcuts leading to other modes"
locked\:"In `Locked` mode, input is always written to the terminal and all shortcuts are disabled except the one leading back to normal mode"
resize\:"`Resize` mode allows resizing the different existing panes"
pane\:"`Pane` mode allows creating and closing panes, as well as moving between them"
tab\:"`Tab` mode allows creating and closing tabs, as well as moving between them"
scroll\:"`Scroll` mode allows scrolling up and down within a pane"
enter-search\:"`EnterSearch` mode allows for typing in the needle for a search in the scroll buffer of a pane"
search\:"`Search` mode allows for searching a term in a pane (superset of `Scroll`)"
rename-tab\:"`RenameTab` mode allows assigning a new name to a tab"
rename-pane\:"`RenamePane` mode allows assigning a new name to a pane"
session\:"`Session` mode allows detaching sessions"
move\:"`Move` mode allows moving the different existing panes within a tab"
prompt\:"`Prompt` mode allows interacting with active prompts"
tmux\:"`Tmux` mode allows for basic tmux keybindings functionality"))' \
'*--default-shell=[Set the default shell]:DEFAULT_SHELL:_files' \
'*--default-layout=[Set the default layout]:DEFAULT_LAYOUT:_files' \
'*--layout-dir=[Set the layout_dir, defaults to subdirectory of config dir]:LAYOUT_DIR:_files' \
'*--theme-dir=[Set the theme_dir, defaults to subdirectory of config dir]:THEME_DIR:_files' \
'*--mouse-mode=[Set the handling of mouse events (true or false) Can be temporarily bypassed by the \[SHIFT\] key]:MOUSE_MODE:(true false)' \
'*--pane-frames=[Set display of the pane frames (true or false)]:PANE_FRAMES:(true false)' \
'*--mirror-session=[Mirror session when multiple users are connected (true or false)]:MIRROR_SESSION:(true false)' \
'*--on-force-close=[Set behaviour on force close (quit or detach)]:ON_FORCE_CLOSE:(quit detach)' \
'*--scroll-buffer-size=[]:SCROLL_BUFFER_SIZE: ' \
'*--copy-command=[Switch to using a user supplied command for clipboard instead of OSC52]:COPY_COMMAND: ' \
'(--copy-command)*--copy-clipboard=[OSC52 destination clipboard]:COPY_CLIPBOARD:(system primary)' \
'*--copy-on-select=[Automatically copy when selecting text (true or false)]:COPY_ON_SELECT:(true false)' \
'*--scrollback-editor=[Explicit full path to open the scrollback editor (default is $EDITOR or $VISUAL)]:SCROLLBACK_EDITOR:_files' \
'*--session-name=[The name of the session to create when starting Zellij]:SESSION_NAME: ' \
'*--attach-to-session=[Whether to attach to a session specified in "session-name" if it exists]:ATTACH_TO_SESSION:(true false)' \
'*--auto-layout=[Whether to lay out panes in a predefined set of layouts whenever possible]:AUTO_LAYOUT:(true false)' \
'(--mouse-mode)*--disable-mouse-mode[Disable handling of mouse events]' \
'(--pane-frames)*--no-pane-frames[Disable display of pane frames]' \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
'*::subcommand -- The subcommand whose help message to display:' \
&& ret=0
;;
esac
;;
esac
;;
(kill-session)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
'::target-session -- Name of target session:' \
&& ret=0
;;
(kill-all-sessions)
_arguments "${_arguments_options[@]}" \
'*-y[Automatic yes to prompts]' \
'*--yes[Automatic yes to prompts]' \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(action)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
":: :_zellij__action_commands" \
"*::: :->action" \
&& ret=0
case $state in
(action)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:zellij-action-command-$line[1]:"
case $line[1] in
(write)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
'*::bytes:' \
&& ret=0
;;
(write-chars)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
':chars:' \
&& ret=0
;;
(resize)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
':resize:' \
'::direction:' \
&& ret=0
;;
(focus-next-pane)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(focus-previous-pane)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(move-focus)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
':direction:' \
&& ret=0
;;
(move-focus-or-tab)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
':direction:' \
&& ret=0
;;
(move-pane)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
'::direction:' \
&& ret=0
;;
(move-pane-backwards)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(clear)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(dump-screen)
_arguments "${_arguments_options[@]}" \
'*-f[Dump the pane with full scrollback]' \
'*--full[Dump the pane with full scrollback]' \
'-h[Print help information]' \
'--help[Print help information]' \
':path:' \
&& ret=0
;;
(edit-scrollback)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(scroll-up)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(scroll-down)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(scroll-to-bottom)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(scroll-to-top)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(page-scroll-up)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(page-scroll-down)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(half-page-scroll-up)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(half-page-scroll-down)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(toggle-fullscreen)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(toggle-pane-frames)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(toggle-active-sync-tab)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(new-pane)
_arguments "${_arguments_options[@]}" \
'(-f --floating)*-d+[Direction to open the new pane in]:DIRECTION: ' \
'(-f --floating)*--direction=[Direction to open the new pane in]:DIRECTION: ' \
'(-d --direction)-p+[]:PLUGIN: ' \
'(-d --direction)--plugin=[]:PLUGIN: ' \
'*--cwd=[Change the working directory of the new pane]:CWD:_files' \
'*-n+[Name of the new pane]:NAME: ' \
'*--name=[Name of the new pane]:NAME: ' \
'*-f[Open the new pane in floating mode]' \
'*--floating[Open the new pane in floating mode]' \
'*-c[Close the pane immediately when its command exits]' \
'*--close-on-exit[Close the pane immediately when its command exits]' \
'*-s[Start the command suspended, only running it after the you first press ENTER]' \
'*--start-suspended[Start the command suspended, only running it after the you first press ENTER]' \
'-h[Print help information]' \
'--help[Print help information]' \
'*::command:' \
&& ret=0
;;
(edit)
_arguments "${_arguments_options[@]}" \
'(-f --floating)*-d+[Direction to open the new pane in]:DIRECTION: ' \
'(-f --floating)*--direction=[Direction to open the new pane in]:DIRECTION: ' \
'*-l+[Open the file in the specified line number]:LINE_NUMBER: ' \
'*--line-number=[Open the file in the specified line number]:LINE_NUMBER: ' \
'*--cwd=[Change the working directory of the editor]:CWD:_files' \
'*-f[Open the new pane in floating mode]' \
'*--floating[Open the new pane in floating mode]' \
'-h[Print help information]' \
'--help[Print help information]' \
':file:' \
&& ret=0
;;
(switch-mode)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
':input-mode:' \
&& ret=0
;;
(toggle-pane-embed-or-floating)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(toggle-floating-panes)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(close-pane)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(rename-pane)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
':name:' \
&& ret=0
;;
(undo-rename-pane)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(go-to-next-tab)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(go-to-previous-tab)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(close-tab)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(go-to-tab)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
':index:' \
&& ret=0
;;
(go-to-tab-name)
_arguments "${_arguments_options[@]}" \
'*-c[Create a tab if one does not exist]' \
'*--create[Create a tab if one does not exist]' \
'-h[Print help information]' \
'--help[Print help information]' \
':name:' \
&& ret=0
;;
(rename-tab)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
':name:' \
&& ret=0
;;
(undo-rename-tab)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(new-tab)
_arguments "${_arguments_options[@]}" \
'*-l+[Layout to use for the new tab]:LAYOUT:_files' \
'*--layout=[Layout to use for the new tab]:LAYOUT:_files' \
'*--layout-dir=[Default folder to look for layouts]:LAYOUT_DIR:_files' \
'*-n+[Name of the new tab]:NAME: ' \
'*--name=[Name of the new tab]:NAME: ' \
'*-c+[Change the working directory of the new tab]:CWD:_files' \
'*--cwd=[Change the working directory of the new tab]:CWD:_files' \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(previous-swap-layout)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(next-swap-layout)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(query-tab-names)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
'*::subcommand -- The subcommand whose help message to display:' \
&& ret=0
;;
esac
;;
esac
;;
(run)
_arguments "${_arguments_options[@]}" \
'(-f --floating)*-d+[Direction to open the new pane in]:DIRECTION: ' \
'(-f --floating)*--direction=[Direction to open the new pane in]:DIRECTION: ' \
'*--cwd=[Change the working directory of the new pane]:CWD:_files' \
'*-n+[Name of the new pane]:NAME: ' \
'*--name=[Name of the new pane]:NAME: ' \
'*-f[Open the new pane in floating mode]' \
'*--floating[Open the new pane in floating mode]' \
'*-c[Close the pane immediately when its command exits]' \
'*--close-on-exit[Close the pane immediately when its command exits]' \
'*-s[Start the command suspended, only running after you first presses ENTER]' \
'*--start-suspended[Start the command suspended, only running after you first presses ENTER]' \
'-h[Print help information]' \
'--help[Print help information]' \
'*::command -- Command to run:' \
&& ret=0
;;
(edit)
_arguments "${_arguments_options[@]}" \
'*-l+[Open the file in the specified line number]:LINE_NUMBER: ' \
'*--line-number=[Open the file in the specified line number]:LINE_NUMBER: ' \
'(-f --floating)*-d+[Direction to open the new pane in]:DIRECTION: ' \
'(-f --floating)*--direction=[Direction to open the new pane in]:DIRECTION: ' \
'*--cwd=[Change the working directory of the editor]:CWD:_files' \
'*-f[Open the new pane in floating mode]' \
'*--floating[Open the new pane in floating mode]' \
'-h[Print help information]' \
'--help[Print help information]' \
':file:' \
&& ret=0
;;
(convert-config)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
':old-config-file:' \
&& ret=0
;;
(convert-layout)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
':old-layout-file:' \
&& ret=0
;;
(convert-theme)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
':old-theme-file:' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
'*::subcommand -- The subcommand whose help message to display:' \
&& ret=0
;;
esac
;;
esac
}
(( $+functions[_zellij_commands] )) ||
_zellij_commands() {
local commands; commands=(
'options:Change the behaviour of zellij' \
'setup:Setup zellij and check its configuration' \
'list-sessions:List active sessions' \
'ls:List active sessions' \
'attach:Attach to a session' \
'a:Attach to a session' \
'kill-session:Kill the specific session' \
'k:Kill the specific session' \
'kill-all-sessions:Kill all sessions' \
'ka:Kill all sessions' \
'action:Send actions to a specific session' \
'ac:Send actions to a specific session' \
'run:Run a command in a new pane' \
'r:Run a command in a new pane' \
'edit:Edit file with default $EDITOR / $VISUAL' \
'e:Edit file with default $EDITOR / $VISUAL' \
'convert-config:' \
'convert-layout:' \
'convert-theme:' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'zellij commands' commands "$@"
}
(( $+functions[_zellij__action_commands] )) ||
_zellij__action_commands() {
local commands; commands=(
'write:Write bytes to the terminal' \
'write-chars:Write characters to the terminal' \
'resize:\[increase|decrease\] the focused panes area at the \[left|down|up|right\] border' \
'focus-next-pane:Change focus to the next pane' \
'focus-previous-pane:Change focus to the previous pane' \
'move-focus:Move the focused pane in the specified direction. \[right|left|up|down\]' \
'move-focus-or-tab:Move focus to the pane or tab (if on screen edge) in the specified direction \[right|left|up|down\]' \
'move-pane:Change the location of the focused pane in the specified direction or rotate forwrads \[right|left|up|down\]' \
'move-pane-backwards:Rotate the location of the previous pane backwards' \
'clear:Clear all buffers for a focused pane' \
'dump-screen:Dump the focused pane to a file' \
'edit-scrollback:Open the pane scrollback in your default editor' \
'scroll-up:Scroll up in the focused pane' \
'scroll-down:Scroll down in focus pane' \
'scroll-to-bottom:Scroll down to bottom in focus pane' \
'scroll-to-top:Scroll up to top in focus pane' \
'page-scroll-up:Scroll up one page in focus pane' \
'page-scroll-down:Scroll down one page in focus pane' \
'half-page-scroll-up:Scroll up half page in focus pane' \
'half-page-scroll-down:Scroll down half page in focus pane' \
'toggle-fullscreen:Toggle between fullscreen focus pane and normal layout' \
'toggle-pane-frames:Toggle frames around panes in the UI' \
'toggle-active-sync-tab:Toggle between sending text commands to all panes on the current tab and normal mode' \
'new-pane:Open a new pane in the specified direction \[right|down\] If no direction is specified, will try to use the biggest available space' \
'edit:Open the specified file in a new zellij pane with your default EDITOR' \
'switch-mode:Switch input mode of all connected clients \[locked|pane|tab|resize|move|search|session\]' \
'toggle-pane-embed-or-floating:Embed focused pane if floating or float focused pane if embedded' \
'toggle-floating-panes:Toggle the visibility of all fdirectionloating panes in the current Tab, open one if none exist' \
'close-pane:Close the focused pane' \
'rename-pane:Renames the focused pane' \
'undo-rename-pane:Remove a previously set pane name' \
'go-to-next-tab:Go to the next tab' \
'go-to-previous-tab:Go to the previous tab' \
'close-tab:Close the current tab' \
'go-to-tab:Go to tab with index \[index\]' \
'go-to-tab-name:Go to tab with name \[name\]' \
'rename-tab:Renames the focused pane' \
'undo-rename-tab:Remove a previously set tab name' \
'new-tab:Create a new tab, optionally with a specified tab layout and name' \
'previous-swap-layout:' \
'next-swap-layout:' \
'query-tab-names:Query all tab names' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'zellij action commands' commands "$@"
}
(( $+functions[_zellij__attach_commands] )) ||
_zellij__attach_commands() {
local commands; commands=(
'options:Change the behaviour of zellij' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'zellij attach commands' commands "$@"
}
(( $+functions[_zellij__action__clear_commands] )) ||
_zellij__action__clear_commands() {
local commands; commands=()
_describe -t commands 'zellij action clear commands' commands "$@"
}
(( $+functions[_zellij__action__close-pane_commands] )) ||
_zellij__action__close-pane_commands() {
local commands; commands=()
_describe -t commands 'zellij action close-pane commands' commands "$@"
}
(( $+functions[_zellij__action__close-tab_commands] )) ||
_zellij__action__close-tab_commands() {
local commands; commands=()
_describe -t commands 'zellij action close-tab commands' commands "$@"
}
(( $+functions[_zellij__convert-config_commands] )) ||
_zellij__convert-config_commands() {
local commands; commands=()
_describe -t commands 'zellij convert-config commands' commands "$@"
}
(( $+functions[_zellij__convert-layout_commands] )) ||
_zellij__convert-layout_commands() {
local commands; commands=()
_describe -t commands 'zellij convert-layout commands' commands "$@"
}
(( $+functions[_zellij__convert-theme_commands] )) ||
_zellij__convert-theme_commands() {
local commands; commands=()
_describe -t commands 'zellij convert-theme commands' commands "$@"
}
(( $+functions[_zellij__action__dump-screen_commands] )) ||
_zellij__action__dump-screen_commands() {
local commands; commands=()
_describe -t commands 'zellij action dump-screen commands' commands "$@"
}
(( $+functions[_zellij__action__edit_commands] )) ||
_zellij__action__edit_commands() {
local commands; commands=()
_describe -t commands 'zellij action edit commands' commands "$@"
}
(( $+functions[_zellij__edit_commands] )) ||
_zellij__edit_commands() {
local commands; commands=()
_describe -t commands 'zellij edit commands' commands "$@"
}
(( $+functions[_zellij__action__edit-scrollback_commands] )) ||
_zellij__action__edit-scrollback_commands() {
local commands; commands=()
_describe -t commands 'zellij action edit-scrollback commands' commands "$@"
}
(( $+functions[_zellij__action__focus-next-pane_commands] )) ||
_zellij__action__focus-next-pane_commands() {
local commands; commands=()
_describe -t commands 'zellij action focus-next-pane commands' commands "$@"
}
(( $+functions[_zellij__action__focus-previous-pane_commands] )) ||
_zellij__action__focus-previous-pane_commands() {
local commands; commands=()
_describe -t commands 'zellij action focus-previous-pane commands' commands "$@"
}
(( $+functions[_zellij__action__go-to-next-tab_commands] )) ||
_zellij__action__go-to-next-tab_commands() {
local commands; commands=()
_describe -t commands 'zellij action go-to-next-tab commands' commands "$@"
}
(( $+functions[_zellij__action__go-to-previous-tab_commands] )) ||
_zellij__action__go-to-previous-tab_commands() {
local commands; commands=()
_describe -t commands 'zellij action go-to-previous-tab commands' commands "$@"
}
(( $+functions[_zellij__action__go-to-tab_commands] )) ||
_zellij__action__go-to-tab_commands() {
local commands; commands=()
_describe -t commands 'zellij action go-to-tab commands' commands "$@"
}
(( $+functions[_zellij__action__go-to-tab-name_commands] )) ||
_zellij__action__go-to-tab-name_commands() {
local commands; commands=()
_describe -t commands 'zellij action go-to-tab-name commands' commands "$@"
}
(( $+functions[_zellij__action__half-page-scroll-down_commands] )) ||
_zellij__action__half-page-scroll-down_commands() {
local commands; commands=()
_describe -t commands 'zellij action half-page-scroll-down commands' commands "$@"
}
(( $+functions[_zellij__action__half-page-scroll-up_commands] )) ||
_zellij__action__half-page-scroll-up_commands() {
local commands; commands=()
_describe -t commands 'zellij action half-page-scroll-up commands' commands "$@"
}
(( $+functions[_zellij__action__help_commands] )) ||
_zellij__action__help_commands() {
local commands; commands=()
_describe -t commands 'zellij action help commands' commands "$@"
}
(( $+functions[_zellij__attach__help_commands] )) ||
_zellij__attach__help_commands() {
local commands; commands=()
_describe -t commands 'zellij attach help commands' commands "$@"
}
(( $+functions[_zellij__help_commands] )) ||
_zellij__help_commands() {
local commands; commands=()
_describe -t commands 'zellij help commands' commands "$@"
}
(( $+functions[_zellij__kill-all-sessions_commands] )) ||
_zellij__kill-all-sessions_commands() {
local commands; commands=()
_describe -t commands 'zellij kill-all-sessions commands' commands "$@"
}
(( $+functions[_zellij__kill-session_commands] )) ||
_zellij__kill-session_commands() {
local commands; commands=()
_describe -t commands 'zellij kill-session commands' commands "$@"
}
(( $+functions[_zellij__list-sessions_commands] )) ||
_zellij__list-sessions_commands() {
local commands; commands=()
_describe -t commands 'zellij list-sessions commands' commands "$@"
}
(( $+functions[_zellij__action__move-focus_commands] )) ||
_zellij__action__move-focus_commands() {
local commands; commands=()
_describe -t commands 'zellij action move-focus commands' commands "$@"
}
(( $+functions[_zellij__action__move-focus-or-tab_commands] )) ||
_zellij__action__move-focus-or-tab_commands() {
local commands; commands=()
_describe -t commands 'zellij action move-focus-or-tab commands' commands "$@"
}
(( $+functions[_zellij__action__move-pane_commands] )) ||
_zellij__action__move-pane_commands() {
local commands; commands=()
_describe -t commands 'zellij action move-pane commands' commands "$@"
}
(( $+functions[_zellij__action__move-pane-backwards_commands] )) ||
_zellij__action__move-pane-backwards_commands() {
local commands; commands=()
_describe -t commands 'zellij action move-pane-backwards commands' commands "$@"
}
(( $+functions[_zellij__action__new-pane_commands] )) ||
_zellij__action__new-pane_commands() {
local commands; commands=()
_describe -t commands 'zellij action new-pane commands' commands "$@"
}
(( $+functions[_zellij__action__new-tab_commands] )) ||
_zellij__action__new-tab_commands() {
local commands; commands=()
_describe -t commands 'zellij action new-tab commands' commands "$@"
}
(( $+functions[_zellij__action__next-swap-layout_commands] )) ||
_zellij__action__next-swap-layout_commands() {
local commands; commands=()
_describe -t commands 'zellij action next-swap-layout commands' commands "$@"
}
(( $+functions[_zellij__attach__options_commands] )) ||
_zellij__attach__options_commands() {
local commands; commands=()
_describe -t commands 'zellij attach options commands' commands "$@"
}
(( $+functions[_zellij__options_commands] )) ||
_zellij__options_commands() {
local commands; commands=()
_describe -t commands 'zellij options commands' commands "$@"
}
(( $+functions[_zellij__action__page-scroll-down_commands] )) ||
_zellij__action__page-scroll-down_commands() {
local commands; commands=()
_describe -t commands 'zellij action page-scroll-down commands' commands "$@"
}
(( $+functions[_zellij__action__page-scroll-up_commands] )) ||
_zellij__action__page-scroll-up_commands() {
local commands; commands=()
_describe -t commands 'zellij action page-scroll-up commands' commands "$@"
}
(( $+functions[_zellij__action__previous-swap-layout_commands] )) ||
_zellij__action__previous-swap-layout_commands() {
local commands; commands=()
_describe -t commands 'zellij action previous-swap-layout commands' commands "$@"
}
(( $+functions[_zellij__action__query-tab-names_commands] )) ||
_zellij__action__query-tab-names_commands() {
local commands; commands=()
_describe -t commands 'zellij action query-tab-names commands' commands "$@"
}
(( $+functions[_zellij__action__rename-pane_commands] )) ||
_zellij__action__rename-pane_commands() {
local commands; commands=()
_describe -t commands 'zellij action rename-pane commands' commands "$@"
}
(( $+functions[_zellij__action__rename-tab_commands] )) ||
_zellij__action__rename-tab_commands() {
local commands; commands=()
_describe -t commands 'zellij action rename-tab commands' commands "$@"
}
(( $+functions[_zellij__action__resize_commands] )) ||
_zellij__action__resize_commands() {
local commands; commands=()
_describe -t commands 'zellij action resize commands' commands "$@"
}
(( $+functions[_zellij__run_commands] )) ||
_zellij__run_commands() {
local commands; commands=()
_describe -t commands 'zellij run commands' commands "$@"
}
(( $+functions[_zellij__action__scroll-down_commands] )) ||
_zellij__action__scroll-down_commands() {
local commands; commands=()
_describe -t commands 'zellij action scroll-down commands' commands "$@"
}
(( $+functions[_zellij__action__scroll-to-bottom_commands] )) ||
_zellij__action__scroll-to-bottom_commands() {
local commands; commands=()
_describe -t commands 'zellij action scroll-to-bottom commands' commands "$@"
}
(( $+functions[_zellij__action__scroll-to-top_commands] )) ||
_zellij__action__scroll-to-top_commands() {
local commands; commands=()
_describe -t commands 'zellij action scroll-to-top commands' commands "$@"
}
(( $+functions[_zellij__action__scroll-up_commands] )) ||
_zellij__action__scroll-up_commands() {
local commands; commands=()
_describe -t commands 'zellij action scroll-up commands' commands "$@"
}
(( $+functions[_zellij__setup_commands] )) ||
_zellij__setup_commands() {
local commands; commands=()
_describe -t commands 'zellij setup commands' commands "$@"
}
(( $+functions[_zellij__action__switch-mode_commands] )) ||
_zellij__action__switch-mode_commands() {
local commands; commands=()
_describe -t commands 'zellij action switch-mode commands' commands "$@"
}
(( $+functions[_zellij__action__toggle-active-sync-tab_commands] )) ||
_zellij__action__toggle-active-sync-tab_commands() {
local commands; commands=()
_describe -t commands 'zellij action toggle-active-sync-tab commands' commands "$@"
}
(( $+functions[_zellij__action__toggle-floating-panes_commands] )) ||
_zellij__action__toggle-floating-panes_commands() {
local commands; commands=()
_describe -t commands 'zellij action toggle-floating-panes commands' commands "$@"
}
(( $+functions[_zellij__action__toggle-fullscreen_commands] )) ||
_zellij__action__toggle-fullscreen_commands() {
local commands; commands=()
_describe -t commands 'zellij action toggle-fullscreen commands' commands "$@"
}
(( $+functions[_zellij__action__toggle-pane-embed-or-floating_commands] )) ||
_zellij__action__toggle-pane-embed-or-floating_commands() {
local commands; commands=()
_describe -t commands 'zellij action toggle-pane-embed-or-floating commands' commands "$@"
}
(( $+functions[_zellij__action__toggle-pane-frames_commands] )) ||
_zellij__action__toggle-pane-frames_commands() {
local commands; commands=()
_describe -t commands 'zellij action toggle-pane-frames commands' commands "$@"
}
(( $+functions[_zellij__action__undo-rename-pane_commands] )) ||
_zellij__action__undo-rename-pane_commands() {
local commands; commands=()
_describe -t commands 'zellij action undo-rename-pane commands' commands "$@"
}
(( $+functions[_zellij__action__undo-rename-tab_commands] )) ||
_zellij__action__undo-rename-tab_commands() {
local commands; commands=()
_describe -t commands 'zellij action undo-rename-tab commands' commands "$@"
}
(( $+functions[_zellij__action__write_commands] )) ||
_zellij__action__write_commands() {
local commands; commands=()
_describe -t commands 'zellij action write commands' commands "$@"
}
(( $+functions[_zellij__action__write-chars_commands] )) ||
_zellij__action__write-chars_commands() {
local commands; commands=()
_describe -t commands 'zellij action write-chars commands' commands "$@"
}
_zellij "$@"
function zr () { zellij run --name "$*" -- zsh -ic "$*";}
function zrf () { zellij run --name "$*" --floating -- zsh -ic "$*";}
function ze () { zellij edit "$*";}
function zef () { zellij edit --floating "$*";}

View file

@ -0,0 +1,32 @@
dnf-save-install() {
file="$DOTS/exports/dnf.txt"
echo "$*" >> "$file"
sort -u -o "$file" "$file"
sudo dnf install -y $(cat "$DOTS/exports/dnf.txt")
}
dnf-load-export() {
while read -r line; do
sudo dnf copr enable -y "$line"
done <"$DOTS/exports/copr.txt"
sudo dnf install -y $(cat "$DOTS/exports/dnf.txt")
}
upgrade() {
sudo dnf upgrade --refresh -y
}
# where did I get this?
mayor-upgrade() {
if [[ $(dnf check-update -q) ]]; then
echo "There are updates pending, update and reboot? [y/N]"
read -r answer
if [[ $answer == 'y' || $answer == 'Y' ]]; then
upgrade
sc-reboot
fi
fi
}

View file

@ -0,0 +1,89 @@
export FLATPAK_ALIAS_FILE="${DOTS:-$HOME/.config}/config/zsh/aliases/flatpak.zsh"
export FLATPAK_EXPORT_FILE="${DOTS:-$HOME/Desktop}/exports/flatpak-apps.txt"
fp() {
set -e
generate_flatpak_alias() {
local flatpak_alias_file=${1:-$FLATPAK_ALIAS_FILE}
[[ -f $flatpak_alias_file ]] && touch "$flatpak_alias_file"
local flatpak_binaries_dir="/var/lib/flatpak/exports/bin"
if [[ -d "$flatpak_binaries_dir" ]]; then
echo -e "\n# Auto-generated aliases for Flatpak applications\n" >> "${flatpak_alias_file}"
while read -r app; do
app_id=$(echo "$app" | awk -F'/' '{print $NF}')
alias_name=$(echo "$app_id" | awk -F'.' '{print $NF}' | tr '[:upper:]' '[:lower:]')
echo "alias $alias_name='flatpak run $app_id'" >> "${flatpak_alias_file}"
done < <(find "$flatpak_binaries_dir" -maxdepth 1 -mindepth 1)
echo "Done generating Flatpak aliases"
echo "Check ${BLD}${BLU}$flatpak_alias_file${RST} to modify auto-generated alias"
else
echo "${RED}${BLD}Error: ${YLW}$flatpak_binaries_dir${RST} directory does not exist"
fi
}
export_flatpak_apps() {
local flatpak_export_file=""${1:-$FLATPAK_EXPORT_FILE}
flatpak list --columns=application --app > "${flatpak_export_file}"
echo "${BLD}${BLU}Flatpak apps exported successfully${RST}"
}
import_flatpak_apps() {
local flatpak_export_file=${1:-$FLATPAK_EXPORT_FILE}
xargs flatpak install -y < "${flatpak_export_file}"
}
show_help() {
echo -e "${BLD}Usage: ${GRN}fp${RST}${YLW} [OPTION]${RST}"
echo -e ""
echo -e "${BLD} Options:${RST}"
echo -e "${YLW} -e, export ${RST}Export a list of installed Flatpak apps to a file"
echo -e "${YLW} -i, import ${RST}Install Flatpak apps from exported file"
echo -e "${YLW} -g, generate ${RST}Generate aliases for all installed Flatpak apps"
echo -e "${YLW} -h, --help ${RST}Show this help"
}
main() {
local action=$1
case $action in
"generate"|"-g")
echo -en "Enter the location to save the Flatpak alias file, \n(default: ${FLATPAK_ALIAS_FILE}): "
read -r user_alias_dir
if [[ -n "$user_alias_dir" ]]; then
FLATPAK_ALIAS_FILE="$user_alias_dir"
fi
generate_flatpak_alias "${FLATPAK_ALIAS_FILE}"
;;
"export"|"-e")
echo -en "Enter the location to save the Flatpak export file (default: ${FLATPAK_EXPORT_FILE}): "
read -r user_export_file
if [[ -n "$user_export_file" ]]; then
FLATPAK_EXPORT_FILE="$user_export_file"
fi
export_flatpak_apps "${FLATPAK_EXPORT_FILE}"
;;
"import"|"-i")
echo -en "Enter the location of the Flatpak export file to import (default: ${FLATPAK_EXPORT_FILE}): "
read -r user_export_file
if [[ -n "$user_export_file" ]]; then
FLATPAK_EXPORT_FILE="$user_export_file"
fi
import_flatpak_apps "${FLATPAK_EXPORT_FILE}"
;;
"--help"|"-h")
show_help
;;
*)
show_help
;;
esac
}
main "$@"
}

View file

@ -0,0 +1,57 @@
# SSH tunnel
ssh-tunnel() {
local_port=$1 && shift
remote_port=$1 && shift
server=$1 && shift
echo "Starting SSH Tunnel for $server"
ssh -N -L "$local_port":localhost:"$remote_port" "$server"
}
# quick wordpress in docker
dwps() {
image_name="wordpress-development"
container_build_path="$HOME/Repos/Private/docker-services/wordpress"
original_path="$PWD"
if [[ "$(docker images -q $image_name 2>/dev/null)" == "" ]]; then
cd "$container_build_path"
docker build --tag "$image_name" .
cd "$original_path"
fi
docker run -d --rm -p 3000:80 --user 1000:1000 -v "$PWD":/var/www/html --name "$image_name" "$image_name"
}
# Print bottlenecks
profzsh() {
shell=${1-$SHELL}
ZPROF=true $shell -i -c exit
}
# Pretty Help
alias bathelp='bat --plain --language=help'
help() {
"$@" --help 2>&1 | bathelp
}
fzf-jq() {
echo '' | fzf --print-query --preview="jq -r {q} <$@"
}
function yy() {
local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" cwd
yazi "$@" --cwd-file="$tmp"
if cwd="$(command cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
builtin cd -- "$cwd"
fi
rm -f -- "$tmp"
}
# Zellij
function zr() { zellij run --name "$*" -- zsh -ic "$*"; }
function zrf() { zellij run --name "$*" --floating -- zsh -ic "$*"; }
function ze() { zellij edit "$*"; }
function zef() { zellij edit --floating "$*"; }

41
configs/zsh/.zprofile Normal file
View file

@ -0,0 +1,41 @@
#!/usr/bin/zsh
update_path() {
export PATH="$PATH:$1"
}
# Set manually
export REPOS="$HOME/.local/share/chezmoi"
export DOTS="$REPOS/Private/dots"
export EDITOR=nvim
export VISUAL="$EDITOR"
export QT_STYLE_OVERRIDE=kvantum
export MOZ_ENABLE_WAYLAND=1
# Use rbw as SSH Agent
# use https://github.com/pmkap/rbw/ until https://github.com/doy/rbw/issues/197 is closed
export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/rbw/ssh-agent-socket"
update_path "$DOTS/scripts"
update_path "$HOME/.local/bin"
update_path "$HOME/bin"
update_path "/usr/local/bin"
# Dev Stuff
export NPM_PACKAGES="$HOME/.npm-packages"
export NODE_PATH="$NPM_PACKAGES/lib/node_modules${NODE_PATH:+:$NODE_PATH}"
update_path "$NPM_PACKAGES/bin"
export PNPM_HOME="$HOME/.local/share/pnpm"
update_path "$PNPM_HOME"
export BUN_INSTALL="$HOME/.bun"
update_path "$BUN_INSTALL/bin"
# bun completions
[ -s "/home/aleidk/.bun/_bun" ] && source "/home/aleidk/.bun/_bun"
source "$HOME/.rye/env"
# . "$HOME/.cargo/env"
update_path "$HOME/.cargo/bin/"

88
configs/zsh/.zshrc Normal file
View file

@ -0,0 +1,88 @@
# ╭──────────────────────────────────────────────────────────╮
# │ ZSH Config │
# ╰──────────────────────────────────────────────────────────╯
# ╭──────────────────────────────────────────────────────────╮
# │ Preoload stuff │
# ╰──────────────────────────────────────────────────────────╯
# Set the directory we want to store zinit and plugins
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit"
# Auto install zinit
[ ! -d $ZINIT_HOME ] && mkdir -p "$(dirname $ZINIT_HOME)"
[ ! -d $ZINIT_HOME/.git ] && git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
# Source/Load zinit, installation is handle by chezmoi external script
source "${ZINIT_HOME}/zinit.zsh"
# source catppuccin theme for zsh-syntax-highlighting
zinit snippet "https://raw.githubusercontent.com/catppuccin/zsh-syntax-highlighting/main/themes/catppuccin_macchiato-zsh-syntax-highlighting.zsh"
# ╭──────────────────────────────────────────────────────────╮
# │ ZSH plugins │
# ╰──────────────────────────────────────────────────────────╯
# BUG: this makes it work funky on some terminals
# zinit light zsh-users/zsh-syntax-highlighting
zinit light zsh-users/zsh-completions
zinit light zsh-users/zsh-autosuggestions
zinit ice pick"async.zsh" src"pure.zsh"
zinit light sindresorhus/pure
# ╭──────────────────────────────────────────────────────────╮
# │ Oh My Zsh snippets │
# ╰──────────────────────────────────────────────────────────╯
zinit ice as"completion"
zinit snippet "https://raw.githubusercontent.com/sharkdp/fd/master/contrib/completion/_fd"
zinit snippet OMZP::colored-man-pages
zinit snippet OMZP::systemd
# ╭──────────────────────────────────────────────────────────╮
# │ History │
# ╰──────────────────────────────────────────────────────────╯
HISTSIZE=5000
HISTFILE=~/.zsh_history
SAVEHIST=$HISTSIZE
HISTDUP=erase
setopt appendhistory
setopt sharehistory
setopt hist_ignore_space
setopt hist_ignore_all_dups
setopt hist_save_no_dups
setopt hist_ignore_dups
setopt hist_find_no_dups
# ╭──────────────────────────────────────────────────────────╮
# │ Source other files │
# ╰──────────────────────────────────────────────────────────╯
# this prevents errors and not loading some files
for file in $HOME/.config/zsh/**/*.zsh; do
source $file
done
# ╭──────────────────────────────────────────────────────────╮
# │ Load completions │
# ╰──────────────────────────────────────────────────────────╯
# Custom completions
fpath+=${XDG_CONFIG_HOME:-$HOME/.config}/zsh/completions
autoload -Uz ${XDG_CONFIG_HOME:-$HOME/.config}/zsh/completions/*
autoload -Uz complist
autoload -Uz compinit && compinit
zinit cdreplay -q
# ╭──────────────────────────────────────────────────────────╮
# │ Init external programs │
# ╰──────────────────────────────────────────────────────────╯
eval "$(zoxide init --cmd cd zsh)"
# . "$HOME/.atuin/bin/env"
eval "$(atuin init zsh)"
. "$HOME/.local/share/../bin/env"