Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: New-line in prompt
- X-seq: zsh-users 1932
- From: Phil Pennock <phil@xxxxxxxxxxxxxxxxxxxxx>
- To: oma1000@xxxxxxxxx
- Subject: Re: New-line in prompt
- Date: Mon, 9 Nov 1998 15:19:09 +0000 (GMT)
- Cc: zsh-users@xxxxxxxxxxxxxxx
- In-reply-to: <Pine.OSF.3.96.981109132554.12190D-100000@xxxxxxxxxxxxxxxxxxxxxxxxx> from "Owen M. Astley" at "Nov 9, 98 01:27:28 pm"
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