From 0f8583540fe54510da6bdc945e8cc6cc80f2cb61 Mon Sep 17 00:00:00 2001 From: Jeff Melton Date: Mon, 8 Sep 2025 10:42:07 -0500 Subject: [PATCH] fixing variable scoping issue --- templates/murex.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/templates/murex.txt b/templates/murex.txt index 91d50ce..84618bc 100644 --- a/templates/murex.txt +++ b/templates/murex.txt @@ -29,10 +29,12 @@ fexec builtin event onPrompt __zoxide_hook=command-completion { {%- when InitHook::Pwd -%} # Emulate a PWD hook by tracking the last directory and updating on prompt. -fexec builtin out $PWD -> set: str __zoxide_oldpwd +fexec builtin out $PWD -> global: str __zoxide_oldpwd fexec builtin event onPrompt __zoxide_hook=command-completion { + # Initialize global if missing (eg new session or cleared state) + if { !$__zoxide_oldpwd } then { fexec builtin out $PWD -> global: str __zoxide_oldpwd } if { $__zoxide_oldpwd != $PWD } then { - fexec builtin out $PWD -> set: str __zoxide_oldpwd + fexec builtin out $PWD -> global: str __zoxide_oldpwd exec zoxide add -- $PWD } } @@ -109,4 +111,4 @@ function {{cmd}}i { __zoxide_zi @PARAMS } {{ section }} # To initialize zoxide, add this to your shell configuration file (usually ~/.murex_profile): # -# zoxide init murex --hook prompt -> source +# zoxide init murex -> source