diff options
Diffstat (limited to 'dot_config/nushell/autoload/completer.nu')
| -rw-r--r-- | dot_config/nushell/autoload/completer.nu | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/dot_config/nushell/autoload/completer.nu b/dot_config/nushell/autoload/completer.nu new file mode 100644 index 0000000..910305e --- /dev/null +++ b/dot_config/nushell/autoload/completer.nu @@ -0,0 +1,56 @@ +#let fish_completer = {|spans| +# fish --command $"complete '--do-complete=($spans | str replace --all "'" "\\'" | str join ' ')'" +# | from tsv --flexible --noheaders --no-infer +# | rename value description +# | update value {|row| +# let value = $row.value +# let need_quote = ['\' ',' '[' ']' '(' ')' ' ' '\t' "'" '"' "`"] | any {$in in $value} +# if ($need_quote and ($value | path exists)) { +# let expanded_path = if ($value starts-with ~) {$value | path expand --no-symlink} else {$value} +# $'"($expanded_path | str replace --all "\"" "\\\"")"' +# } else {$value} +# } +#} +# +# +#let carapace_completer = {|spans: list<string>| +# carapace $spans.0 nushell ...$spans +# | from json +# | if ($in | default [] | any {|| $in.display | str starts-with "ERR"}) { null } else { $in } +#} +# +## This completer will use carapace by default +#let external_completer = {|spans| +# let expanded_alias = scope aliases +# | where name == $spans.0 +# | get -o 0.expansion +# +# let spans = if $expanded_alias != null { +# $spans +# | skip 1 +# | prepend ($expanded_alias | split row ' ' | take 1) +# } else { +# $spans +# } +# +# match $spans.0 { +# # carapace completions are incorrect for nu +# nu => $fish_completer +# # fish completes commits and branch names in a nicer way +# git => $fish_completer +# # carapace doesn't have completions for asdf +# asdf => $fish_completer +# _ => $carapace_completer +# } | do $in $spans +#} +# +#$env.config = { +# # ... +# completions: { +# external: { +# enable: true +# completer: $external_completer +# } +# } +# # ... +#} |