Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Prompt theme: Show the original job text after foregrounding



On Aug 28, 12:16pm, Vin Shelton wrote:
}
} I think your latest change has caused alias expansion to occur for the
} upper left prompt.

Indeed, that's a side-effect I hadn't considered.  I've almost entirely
replaced aliases with functions now because of the inability to refer
to positional parameters in zsh aliases, so I hadn't noticed.  I like
it better without the alias expansion too.

Index: Functions/Prompts/prompt_bart_setup
--- Functions/Prompts/prompt_bart_setup.~1.18.~	2011-08-16 23:28:44.000000000 -0700
+++ Functions/Prompts/prompt_bart_setup	2011-08-29 08:38:17.000000000 -0700
@@ -70,7 +70,7 @@
 typeset PSCMD=
 
 prompt_bart_preexec () {
-    setopt localoptions noxtrace noksharrays unset
+    setopt localoptions noxtrace noshwordsplit noksharrays unset
     local -a cmd; cmd=( ${(z)3} )
     if [[ $cmd[1] = fg ]]
     then
@@ -84,7 +84,8 @@
     then
 	PSCMD=$jobtexts[%?$2]
     else
-	PSCMD=$2
+	# Use history text to avoid alias expansion
+	PSCMD=$history[$HISTCMD]
     fi
     return 0
 }


-- 
Barton E. Schaefer



Messages sorted by: Reverse Date, Date, Thread, Author