Conditional completer (use fish on linux)

This commit is contained in:
David Holland 2023-07-07 09:11:31 +02:00
parent 7702ac9e9c
commit 001d629035
Signed by: DustVoice
GPG Key ID: 47068995A14EDCA9
1 changed files with 6 additions and 1 deletions

View File

@ -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: {