From 1599dbe329bc1866b76b31afe8acbf33b6975baa Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Fri, 18 Apr 2025 19:31:13 -0700 Subject: [PATCH] feat: use better nushell fish completion path parser --- hm/modules/common/shellenv/config.nu | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/hm/modules/common/shellenv/config.nu b/hm/modules/common/shellenv/config.nu index 08f950b..7dc977b 100644 --- a/hm/modules/common/shellenv/config.nu +++ b/hm/modules/common/shellenv/config.nu @@ -1,13 +1,12 @@ 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} } } + # This completer will use fish by default let external_completer = {|spans| let expanded_alias = scope aliases