refactor: switch from `--` to the caret sigil `^`

This commit is contained in:
Steven Xu 2025-05-31 03:41:44 +10:00
parent a9810be8d5
commit f3f3b2064d
1 changed files with 4 additions and 4 deletions

View File

@ -26,7 +26,7 @@ export-env {
if not $__zoxide_hooked { if not $__zoxide_hooked {
$env.config.hooks.pre_prompt = ($env.config.hooks.pre_prompt | append { $env.config.hooks.pre_prompt = ($env.config.hooks.pre_prompt | append {
__zoxide_hook: true, __zoxide_hook: true,
code: {|| zoxide add '--' $env.PWD} code: {|| ^zoxide add -- $env.PWD}
}) })
} }
{%- else if hook == InitHook::Pwd %} {%- else if hook == InitHook::Pwd %}
@ -43,7 +43,7 @@ export-env {
if not $__zoxide_hooked { if not $__zoxide_hooked {
$env.config.hooks.env_change.PWD = ($env.config.hooks.env_change.PWD | append { $env.config.hooks.env_change.PWD = ($env.config.hooks.env_change.PWD | append {
__zoxide_hook: true, __zoxide_hook: true,
code: {|_, dir| zoxide add '--' $dir} code: {|_, dir| ^zoxide add -- $dir}
}) })
} }
{%- endif %} {%- endif %}
@ -62,7 +62,7 @@ def --env --wrapped __zoxide_z [...rest: string] {
[ '-' ] => {'-'}, [ '-' ] => {'-'},
[ $arg ] if ($arg | path expand | path type) == 'dir' => {$arg} [ $arg ] if ($arg | path expand | path type) == 'dir' => {$arg}
_ => { _ => {
zoxide query --exclude $env.PWD '--' ...$rest | str trim -r -c "\n" ^zoxide query --exclude $env.PWD -- ...$rest | str trim -r -c "\n"
} }
} }
cd $path cd $path
@ -73,7 +73,7 @@ def --env --wrapped __zoxide_z [...rest: string] {
# Jump to a directory using interactive search. # Jump to a directory using interactive search.
def --env --wrapped __zoxide_zi [...rest:string] { def --env --wrapped __zoxide_zi [...rest:string] {
cd $'(zoxide query --interactive '--' ...$rest | str trim -r -c "\n")' cd $'(^zoxide query --interactive -- ...$rest | str trim -r -c "\n")'
{%- if echo %} {%- if echo %}
echo $env.PWD echo $env.PWD
{%- endif %} {%- endif %}