1
1
{%- let section = "# =============================================================================\n#" -%}
2
2
{%- let not_configured = "# -- not configured --" -%}
3
3
4
- # Code generated by zoxide. DO NOT EDIT.
4
+ {{ section }}
5
+ # Utility functions for zoxide.
6
+ #
7
+
8
+ # cd + custom logic based on the value of _ZO_ECHO.
9
+ fexec builtin function __zoxide_cd {
10
+ fexec builtin cd $PARAMS[0]
11
+ {%- if echo %}
12
+ fexec builtin out $PWD
13
+ {%- endif %}
14
+ }
5
15
6
16
{{ section }}
7
17
# Hook configuration for zoxide.
12
22
{{ not_configured }}
13
23
14
24
{%- when InitHook::Prompt -%}
15
- # Update database after each command completes .
16
- event onPrompt zoxide =command-completion {
17
- zoxide add -- $PWD
25
+ # Initialize hook to add new entries to the database .
26
+ fexec builtin event onPrompt __zoxide_hook =command-completion {
27
+ exec zoxide add -- $PWD
18
28
}
19
29
20
30
{%- when InitHook::Pwd -%}
21
- out "zoxide: PWD hooks are not supported on Murex."
22
- out " Use 'zoxide init murex --hook prompt' instead."
31
+ fexec builtin out "zoxide: PWD hooks are not supported on Murex.
32
+ fexec builtin out " Use 'zoxide init murex --hook prompt' instead."
23
33
24
34
{%- endmatch %}
25
35
@@ -28,36 +38,21 @@ out " Use 'zoxide init murex --hook prompt' instead."
28
38
#
29
39
30
40
# Jump to a directory using only keywords.
31
- function __zoxide_z {
32
- # No args: go home
33
- if { !$ARGS } {
34
- cd ~
35
- {%- if echo %} out $PWD {%- endif %}
36
- return
41
+ fexec builtin function __zoxide_z {
42
+ if { !$PARAMS } then {
43
+ fexec function __zoxide_cd ~
44
+ fexec builtin return
37
45
}
38
-
39
- # Previous dir
40
- if { $ARGS[0] == "-" } {
41
- cd -
42
- {%- if echo %} out $PWD {%- endif %}
43
- return
46
+ if { $PARAMS[0] == "-" } then {
47
+ fexec function __zoxide_cd -
48
+ fexec builtin return
44
49
}
45
-
46
- # Query and jump
47
- zoxide query --exclude $PWD -- @PARAMS -> set: str __z
48
- cd $__z
49
- {%- if echo %}
50
- out $PWD
51
- {%- endif %}
50
+ exec zoxide query --exclude $PWD -- @PARAMS -> set: str __zoxide_result && fexec function __zoxide_cd $__zoxide_result
52
51
}
53
52
54
53
# Jump to a directory using interactive search.
55
- function __zoxide_zi {
56
- zoxide query --interactive -- @PARAMS -> set: str __z
57
- cd $__z
58
- {%- if echo %}
59
- out $PWD
60
- {%- endif %}
54
+ fexec builtin function __zoxide_zi {
55
+ exec zoxide query --interactive -- @PARAMS -> set: str __zoxide_result && fexec function __zoxide_cd $__zoxide_result
61
56
}
62
57
63
58
{{ section }}
@@ -77,7 +72,6 @@ function {{cmd}}i { __zoxide_zi @PARAMS }
77
72
{%- endmatch %}
78
73
79
74
{{ section }}
80
- # To initialize zoxide, add this to your Murex profile ( ~/.murex_profile):
75
+ # To initialize zoxide, add this to your shell configuration file (usually ~/.murex_profile):
81
76
#
82
- # zoxide init murex --hook prompt -> source
83
-
77
+ # zoxide init murex --hook prompt -> source
0 commit comments