Bugfixes + consistency

This commit is contained in:
Ajeet D'Souza 2025-09-07 11:05:54 +05:30
parent 255419606a
commit 11362b0c97
1 changed files with 28 additions and 34 deletions

View File

@ -1,7 +1,17 @@
{%- let section = "# =============================================================================\n#" -%}
{%- let not_configured = "# -- not configured --" -%}
# Code generated by zoxide. DO NOT EDIT.
{{ section }}
# Utility functions for zoxide.
#
# cd + custom logic based on the value of _ZO_ECHO.
fexec builtin function __zoxide_cd {
fexec builtin cd $PARAMS[0]
{%- if echo %}
fexec builtin out $PWD
{%- endif %}
}
{{ section }}
# Hook configuration for zoxide.
@ -12,14 +22,14 @@
{{ not_configured }}
{%- when InitHook::Prompt -%}
# Update database after each command completes.
event onPrompt zoxide=command-completion {
zoxide add -- $PWD
# Initialize hook to add new entries to the database.
fexec builtin event onPrompt __zoxide_hook=command-completion {
exec zoxide add -- $PWD
}
{%- when InitHook::Pwd -%}
out "zoxide: PWD hooks are not supported on Murex."
out " Use 'zoxide init murex --hook prompt' instead."
fexec builtin out "zoxide: PWD hooks are not supported on Murex.
fexec builtin out " Use 'zoxide init murex --hook prompt' instead."
{%- endmatch %}
@ -28,36 +38,21 @@ out " Use 'zoxide init murex --hook prompt' instead."
#
# Jump to a directory using only keywords.
function __zoxide_z {
# No args: go home
if { !$ARGS } {
cd ~
{%- if echo %} out $PWD {%- endif %}
return
fexec builtin function __zoxide_z {
if { !$PARAMS } then {
fexec function __zoxide_cd ~
fexec builtin return
}
# Previous dir
if { $ARGS[0] == "-" } {
cd -
{%- if echo %} out $PWD {%- endif %}
return
if { $PARAMS[0] == "-" } then {
fexec function __zoxide_cd -
fexec builtin return
}
# Query and jump
zoxide query --exclude $PWD -- @PARAMS -> set: str __z
cd $__z
{%- if echo %}
out $PWD
{%- endif %}
exec zoxide query --exclude $PWD -- @PARAMS -> set: str __zoxide_result && fexec function __zoxide_cd $__zoxide_result
}
# Jump to a directory using interactive search.
function __zoxide_zi {
zoxide query --interactive -- @PARAMS -> set: str __z
cd $__z
{%- if echo %}
out $PWD
{%- endif %}
fexec builtin function __zoxide_zi {
exec zoxide query --interactive -- @PARAMS -> set: str __zoxide_result && fexec function __zoxide_cd $__zoxide_result
}
{{ section }}
@ -77,7 +72,6 @@ function {{cmd}}i { __zoxide_zi @PARAMS }
{%- endmatch %}
{{ section }}
# To initialize zoxide, add this to your Murex profile (~/.murex_profile):
# To initialize zoxide, add this to your shell configuration file (usually ~/.murex_profile):
#
# zoxide init murex --hook prompt -> source
# zoxide init murex --hook prompt -> source