Compare commits

...

4 Commits

Author SHA1 Message Date
Alessandro Candido aace1d7e1e
Merge 279f85ccec into 194f8e31e4 2025-10-06 16:15:32 -07:00
Ajeet D'Souza 194f8e31e4
Update README.md 2025-10-03 02:59:45 +05:30
Ajeet D'Souza eb7b08fed3
Update README.md 2025-09-30 18:34:43 +05:30
Alessandro Candido 279f85ccec
feat: Provide jump commands completion for nushell
Create completing function, wrapping zoxide query, and attach to jumping
commands arguments.
2025-06-05 21:36:11 +02:00
2 changed files with 21 additions and 4 deletions

View File

@ -12,12 +12,12 @@
<sup>Special thanks to:</sup>
<!-- markdownlint-disable-next-line MD013 -->
<div><img alt="Sponsored by Warp" width="230" src="https://raw.githubusercontent.com/warpdotdev/brand-assets/refs/heads/main/Github/Sponsor/Warp-Github-LG-03.png" /></div>
<div><a href="https://go.warp.dev/zoxide"><img alt="Sponsored by Warp" width="230" src="https://raw.githubusercontent.com/warpdotdev/brand-assets/refs/heads/main/Github/Sponsor/Warp-Github-LG-03.png" /></a></div>
<div><sup><b>Warp, built for coding with multiple AI agents.</b></sup></div>
<div><sup>Available for macOS, Linux, and Windows.</sup></div>
<div><sup>
Visit
<a href="https://www.warp.dev/?utm_source=github&utm_medium=referral&utm_campaign=zoxide_20231001"><u>warp.dev</u></a>
<a href="https://go.warp.dev/zoxide"><u>warp.dev</u></a>
to learn more.
</sup></div>

View File

@ -55,8 +55,25 @@ export-env {
# When using zoxide with --no-cmd, alias these internal functions as desired.
#
# Provide suitable completion for zoxide jump commands
def zoxide_completer [context: string] {
let query = $context | split row " " | slice 1..
let matches = zoxide query -l ...$query | lines | where {|x| $x != $env.PWD}
let completions = $matches | if ($in | is-not-empty) { $in } else { null }
{
options: {
case_sensitive: false,
completion_algorithm: fuzzy,
positional: false,
sort: false,
},
completions: $completions
}
}
# Jump to a directory using only keywords.
def --env --wrapped __zoxide_z [...rest: string] {
def --env --wrapped __zoxide_z [...rest: string@zoxide_completer] {
let path = match $rest {
[] => {'~'},
[ '-' ] => {'-'},
@ -72,7 +89,7 @@ def --env --wrapped __zoxide_z [...rest: string] {
}
# Jump to a directory using interactive search.
def --env --wrapped __zoxide_zi [...rest:string] {
def --env --wrapped __zoxide_zi [...rest:string@zoxide_completer] {
cd $'(^zoxide query --interactive -- ...$rest | str trim -r -c "\n")'
{%- if echo %}
echo $env.PWD