Skip to content

Commit 12a520d

Browse files
authored
Update nushell completion
1 parent 2299f28 commit 12a520d

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

templates/nushell.txt

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,25 @@ export-env {
5151

5252
{%- endif %}
5353

54+
def "nu-complete zoxide path" [context: string] {
55+
let parts = $context | split row " " | skip 1
56+
{
57+
options: {
58+
sort: false
59+
completion_algorithm: prefix
60+
positional: false
61+
case_sensitive: false
62+
}
63+
completions: (zoxide query --list --exclude $env.PWD -- ...$parts | lines)
64+
}
65+
}
66+
5467
{{ section }}
5568
# When using zoxide with --no-cmd, alias these internal functions as desired.
5669
#
5770

5871
# Jump to a directory using only keywords.
59-
def --env --wrapped __zoxide_z [...rest: string] {
72+
def --env --wrapped __zoxide_z [...rest: string@"nu-complete zoxide path"] {
6073
let path = match $rest {
6174
[] => {'~'},
6275
[ '-' ] => {'-'},
@@ -72,7 +85,7 @@ def --env --wrapped __zoxide_z [...rest: string] {
7285
}
7386

7487
# Jump to a directory using interactive search.
75-
def --env --wrapped __zoxide_zi [...rest:string] {
88+
def --env --wrapped __zoxide_zi [...rest:string@"nu-complete zoxide path"] {
7689
cd $'(^zoxide query --interactive -- ...$rest | str trim -r -c "\n")'
7790
{%- if echo %}
7891
echo $env.PWD

0 commit comments

Comments
 (0)