From 001d62903572944651ccf02ebded09940da74695 Mon Sep 17 00:00:00 2001 From: DustVoice Date: Fri, 7 Jul 2023 09:11:31 +0200 Subject: [PATCH] Conditional completer (use fish on linux) --- .config/nushell/config.nu | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.config/nushell/config.nu b/.config/nushell/config.nu index 6815c816..9860aec9 100644 --- a/.config/nushell/config.nu +++ b/.config/nushell/config.nu @@ -181,6 +181,11 @@ let carapace_completer = {|spans| carapace $spans.0 nushell $spans | from json } +let fish_completer = {|spans| + fish --command $'complete "--do-complete=($spans | str join " ")"' + | $"value(char tab)description(char newline)" + $in + | from tsv --flexible --no-infer +} # The default config record. This is where much of your global configuration is setup. let-env config = { @@ -278,7 +283,7 @@ let-env config = { external: { enable: true # set to false to prevent nushell looking into $env.PATH to find more suggestions, `false` recommended for WSL users as this look up my be very slow max_results: 50 # setting it lower can improve completion performance at the cost of omitting some options - completer: $carapace_completer # check 'carapace_completer' above as an example + completer: (if ("OS" not-in $env) or (not $env.OS == "Windows_NT") { $fish_completer } else { $carapace_completer }) # check 'carapace_completer' above as an example } } filesize: {