From 5f0e47c5ee3ab90aaf5ada3f391ae219ffe1d4d2 Mon Sep 17 00:00:00 2001 From: Juhan280 Date: Thu, 2 Jul 2026 02:15:12 +0600 Subject: [PATCH] use fzf based sorting instead of nushell buitin --- templates/nushell.txt | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/templates/nushell.txt b/templates/nushell.txt index 31f19de..f4d3d30 100644 --- a/templates/nushell.txt +++ b/templates/nushell.txt @@ -51,31 +51,20 @@ module zoxide_integration { # def "nu-complete __zoxide_z" [context: string] { - let ast = ast --flatten $context | skip 1 + let ast = ast --flatten $context | skip 1 # skip the command name # If the user has typed a space after the first argument, use the custom # completer. If not, use the built-in directory completion. if ($ast | is-empty) { return null } if $ast.0.span.end >= ($context | str length) { return null } - let completions = ^zoxide query --exclude $env.PWD --list -- ...$ast.content - | lines | each { - if $in starts-with $"($homedir)(char psep)" { - str replace $homedir "~" - } else {} - } | wrap display_override + ^zoxide query --exclude $env.PWD --interactive -- ...$ast.content + | str trim --right --char "\n" + | if $in starts-with $"($homedir)(char psep)" { str replace $homedir "~" } else {} + | wrap display_override | insert value { get display_override | debug --raw-value } | insert span { start: ($ast | first).span.start, end: ($ast | last).span.end } - - { - options: { - sort: false, - filter: false, - case_sensitive: false, - completion_algorithm: "substring", - } - completions: $completions, - } + | [$in] } {{ section }}