2024-07-11 04:06:50 +04:00
|
|
|
compdef _hx hx
|
2022-04-12 12:10:21 +04:00
|
|
|
# Zsh completion script for Helix editor
|
|
|
|
|
|
|
|
_hx() {
|
|
|
|
_arguments -C \
|
|
|
|
"-h[Prints help information]" \
|
|
|
|
"--help[Prints help information]" \
|
|
|
|
"-v[Increase logging verbosity]" \
|
|
|
|
"-vv[Increase logging verbosity]" \
|
|
|
|
"-vvv[Increase logging verbosity]" \
|
|
|
|
"-V[Prints version information]" \
|
|
|
|
"--version[Prints version information]" \
|
|
|
|
"--tutor[Loads the tutorial]" \
|
|
|
|
"--health[Checks for errors in editor setup]:language:->health" \
|
|
|
|
"-g[Fetches or builds tree-sitter grammars]:action:->grammar" \
|
|
|
|
"--grammar[Fetches or builds tree-sitter grammars]:action:->grammar" \
|
2024-07-11 04:06:50 +04:00
|
|
|
"--vsplit[Splits all given files vertically]" \
|
|
|
|
"--hsplit[Splits all given files horizontally]" \
|
2022-08-04 08:05:52 +04:00
|
|
|
"-c[Specifies a file to use for configuration]" \
|
|
|
|
"--config[Specifies a file to use for configuration]" \
|
2024-07-11 04:06:50 +04:00
|
|
|
"-w[Specify initial working directory]" \
|
|
|
|
"--working-dir[Specify initial working directory]" \
|
|
|
|
"--log[Specifies a file to use for logging]" \
|
2022-04-12 12:10:21 +04:00
|
|
|
"*:file:_files"
|
|
|
|
|
|
|
|
case "$state" in
|
|
|
|
health)
|
2024-07-11 04:06:50 +04:00
|
|
|
local languages=($(hx --health | tail -n '+11' | awk '{print $1}' | sed 's/\x1b\[[0-9;]*m//g;s/[✘✓]//g'))
|
2022-04-12 12:10:21 +04:00
|
|
|
_values 'language' $languages
|
|
|
|
;;
|
|
|
|
grammar)
|
|
|
|
_values 'action' fetch build
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|