From 27d90afb7b3f62d89687ae4c1ae6258d2135a70a Mon Sep 17 00:00:00 2001 From: Yuntao Zhao Date: Wed, 29 May 2024 21:13:35 -0700 Subject: [PATCH 1/3] feat: improve hx fish completion - add -w and --working-dir options - shorten option description - dynamically call hx --health --- contrib/completion/hx.fish | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/contrib/completion/hx.fish b/contrib/completion/hx.fish index 11977605791c..8837f80e2be1 100644 --- a/contrib/completion/hx.fish +++ b/contrib/completion/hx.fish @@ -1,15 +1,18 @@ #!/usr/bin/env fish # Fish completion script for Helix editor -set -l langs (hx --health |tail -n '+7' |awk '{print $1}' |sed 's/\x1b\[[0-9;]*m//g') - complete -c hx -s h -l help -d "Prints help information" complete -c hx -l tutor -d "Loads the tutorial" -complete -c hx -l health -x -a "$langs" -d "Checks for errors in editor setup" -complete -c hx -s g -l grammar -x -a "fetch build" -d "Fetches or builds tree-sitter grammars" +complete -c hx -l health -xa "(__hx_langs_ops)" -d "Checks for errors in editor setup" +complete -c hx -s g -l grammar -x -a "fetch build" -d "Fetch or build tree-sitter grammars" complete -c hx -s v -o vv -o vvv -d "Increases logging verbosity" complete -c hx -s V -l version -d "Prints version information" -complete -c hx -l vsplit -d "Splits all given files vertically into different windows" -complete -c hx -l hsplit -d "Splits all given files horizontally into different windows" -complete -c hx -s c -l config -r -d "Specifies a file to use for completion" -complete -c hx -l log -r -d "Specifies a file to write log data into" +complete -c hx -l vsplit -d "Splits all given files vertically" +complete -c hx -l hsplit -d "Splits all given files horizontally" +complete -c hx -s c -l config -r -d "Specifies a file to use for config" +complete -c hx -l log -r -d "Specifies a file to use for logging" +complete -c hx -s w -l working-dir -d "Specify initial working directory" -xa "(__fish_complete_directories)" + +function __hx_langs_ops + hx --health | tail -n '+7' | awk '{print $1}' | sed 's/\x1b\[[0-9;]*m//g' +end From 38ab1acf0619aae415f97bb7d36c058325b53f19 Mon Sep 17 00:00:00 2001 From: Yuntao Zhao Date: Mon, 3 Jun 2024 11:30:29 -0700 Subject: [PATCH 2/3] feat: improve health check completion - remove header - remove check/x characters --- contrib/completion/hx.fish | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/completion/hx.fish b/contrib/completion/hx.fish index 8837f80e2be1..48ca212f0a98 100644 --- a/contrib/completion/hx.fish +++ b/contrib/completion/hx.fish @@ -3,7 +3,7 @@ complete -c hx -s h -l help -d "Prints help information" complete -c hx -l tutor -d "Loads the tutorial" -complete -c hx -l health -xa "(__hx_langs_ops)" -d "Checks for errors in editor setup" +complete -c hx -l health -xa "(__hx_langs_ops)" -d "Checks for errors" complete -c hx -s g -l grammar -x -a "fetch build" -d "Fetch or build tree-sitter grammars" complete -c hx -s v -o vv -o vvv -d "Increases logging verbosity" complete -c hx -s V -l version -d "Prints version information" @@ -14,5 +14,5 @@ complete -c hx -l log -r -d "Specifies a file to use for logging" complete -c hx -s w -l working-dir -d "Specify initial working directory" -xa "(__fish_complete_directories)" function __hx_langs_ops - hx --health | tail -n '+7' | awk '{print $1}' | sed 's/\x1b\[[0-9;]*m//g' + hx --health | tail -n '+11' | string replace -fr '^(\S+) .*' '$1' end From a0d08387765a9e5e38d4a26b504ebbce74586bc6 Mon Sep 17 00:00:00 2001 From: Yuntao Zhao Date: Wed, 5 Jun 2024 14:58:09 -0700 Subject: [PATCH 3/3] feat: use hx --health languages in completion --- contrib/completion/hx.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/completion/hx.fish b/contrib/completion/hx.fish index 48ca212f0a98..f05dba8ddc51 100644 --- a/contrib/completion/hx.fish +++ b/contrib/completion/hx.fish @@ -14,5 +14,5 @@ complete -c hx -l log -r -d "Specifies a file to use for logging" complete -c hx -s w -l working-dir -d "Specify initial working directory" -xa "(__fish_complete_directories)" function __hx_langs_ops - hx --health | tail -n '+11' | string replace -fr '^(\S+) .*' '$1' + hx --health languages | tail -n '+2' | string replace -fr '^(\S+) .*' '$1' end