From b9e5ae8afdb2fe4197aa58ff0670597871b4f742 Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Sat, 29 Mar 2025 12:18:35 -0700 Subject: [PATCH] feat(nushell): update fish and zoxide completer --- hm/modules/common/shellenv/config.nu | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/hm/modules/common/shellenv/config.nu b/hm/modules/common/shellenv/config.nu index a1b809a..9ce10fb 100644 --- a/hm/modules/common/shellenv/config.nu +++ b/hm/modules/common/shellenv/config.nu @@ -1,11 +1,9 @@ let fish_completer = {|spans| - fish --command $'complete --escape "--do-complete=($spans | str join " ")"' - | $"value(char tab)description(char newline)" + $in - | from tsv --flexible --no-infer - | each {|i| - if '\' in $i.value { - $i | merge {'value': $"\"($i.value | str replace -a '\' '')\""} - } else {$i} + fish --command $'complete "--do-complete=($spans | str join " ")"' + | from tsv --flexible --noheaders --no-infer + | rename value description + | update value { + if ($in | path exists) {$'"($in | str replace "\"" "\\\"" )"'} else {$in} } } @@ -29,7 +27,7 @@ let external_completer = {|spans| match $spans.0 { # use zoxide completions for zoxide commands - __zoxide_z | __zoxide_zi => $zoxide_completer + z | zi => $zoxide_completer _ => $fish_completer } | do $in $spans }