diff options
author | Benedikt Müller | 2022-04-12 08:10:21 +0000 |
---|---|---|
committer | GitHub | 2022-04-12 08:10:21 +0000 |
commit | 1fb614443292fe723e764782be560bb2ab3dda4e (patch) | |
tree | 60f7e42042637a923798dd6528de425409190c45 /contrib/completion/hx.zsh | |
parent | 660e0e44b2b6329c1d0af788d624dd5765c2acc6 (diff) |
Add shell completion (#2022)
* Add shell completion
* Add shell completion to release
Diffstat (limited to 'contrib/completion/hx.zsh')
-rw-r--r-- | contrib/completion/hx.zsh | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/contrib/completion/hx.zsh b/contrib/completion/hx.zsh new file mode 100644 index 00000000..16631519 --- /dev/null +++ b/contrib/completion/hx.zsh @@ -0,0 +1,29 @@ +#compdef _hx hx +# 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" \ + "*:file:_files" + + case "$state" in + health) + local languages=($(hx --health |tail -n '+7' |awk '{print $1}' |sed 's/\x1b\[[0-9;]*m//g')) + _values 'language' $languages + ;; + grammar) + _values 'action' fetch build + ;; + esac +} + |