From b3caffe2989e6c3884d2b6eb2c136dd845f80872 Mon Sep 17 00:00:00 2001 From: Erwin Boskma Date: Wed, 24 Jan 2024 17:10:20 +0100 Subject: [PATCH] nushell: Fix config --- home-manager/modules/nushell/config.nu | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/home-manager/modules/nushell/config.nu b/home-manager/modules/nushell/config.nu index d9c85aa..66081e9 100644 --- a/home-manager/modules/nushell/config.nu +++ b/home-manager/modules/nushell/config.nu @@ -1,5 +1,13 @@ -let carapace_completer = {|spans| - carapace $spans.0 nushell ... | from json +let carapace_completer = {|spans| + let expanded_alias = (scope aliases | where name == $spans.0 | get -i 0 | get -i expansion) + + let spans = (if $expanded_alias != null { + spans | skip 1 | prepend ($expanded_alias | split row " " | take 1) + } else { + $spans + }) + + carapace $spans.0 nushell ...$spans | from json } # The default config record. This is where much of your global configuration is setup. @@ -42,7 +50,7 @@ $env.config = { if ($candidates | is-empty) { return null } - let packages = ($candidates | each {|pkg| $"\tnix shell nixpkgs#($pkg.package)" } | str join "\n") + let packages = ($candidates | each {|pkg| $"\tnix shell nixpkgs#($pkg.package)" } | str join "\n") let multiple = if ($candidates | length) > 1 { " one of the following" } else { "" } ( $"The program (ansi $env.config.color_config.shape_external)($cmdname)(ansi reset) " +