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

Re: New-line in prompt



Typing away merrily, Owen M. Astley produced the immortal words:
> I am trying to get a new line (\n) in a prompt (actually I only want the
> new line if the current one is too long).  Has anybody got any idea about
> how to do this?  %{\n%} works but, as the man page says, it shouldn't
> change the cursor position (for obvious reasons if you use it).

How about using a print in the precmd special function?
If you want the normal prompt escapes in it, use the -P option to print.
precmd is called before every prompt.

% function precmd { print -P Funky-%~ }
Funky-~
% echo

Funky-~
% cd /usr
Funky-/usr
% 

Hope this helps.
-- 
--> Phil Pennock ; GAT d- s+:+ a22 C++(++++) UL++++/I+++/S+++/H+ P++@ L+++
E-@ W(+) N>++ o !K w--- O>+ M V !PS PE Y+ PGP+ t-- 5++ X+ R !tv b++>+++ DI+ D+
G+ e+ h* r y?



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