use fzf based sorting instead of nushell buitin
This commit is contained in:
parent
5844cc609a
commit
5f0e47c5ee
|
|
@ -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 }}
|
||||
|
|
|
|||
Loading…
Reference in New Issue