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

Re: forwarded message



On Jun 20,  2:32pm, Richard Coleman wrote:

: In brief, it seems that %{...%} is not working properly inside PS1.
: 
: In tcsh, I use
: 
: set prompt="%{\033]2;%n@%M:%/ - %l\007\033]1;%l@%m\007%}%h [%T] %B%n%b@%m:%B%.2%#%b "

As far as I understand the docs, the string between the %{...%} should
not move the cursor in any way - I'm not sure if your sequence moves the
cursor or not (I haven't really looked: this is a quickie mail), but
this is worth checking in detail.

I don't set my titlebar in this way; I use this method:

One of the features of zsh is the precmd function which gets run before
the prompt is printed.

In my precmd function I call another function called title:

function precmd () { 
	title Zsh
};

function title () 
{
	case $TERM in
		iris-ansi*)	print -n -P "\2201.y$* ~ $USER@%m:%~\234\2203.y~ %m:%~\234\2203.y$USER@%m\234" ;;
		xterm*)	print -Pn "\e]2;$* ~ $USER@%m:%~\a\e]1;$USER@%m\a" ;;
	esac	
}

this sets my title for me on both xwsh and xterm.

My prompt variable looks like this:

CSI='^[['
prompt="%{${CSI}0m%} %(18328#::%{${CSI}32m%}%n )%{${CSI}35m%}%m %{${CSI}31m%}tty%l %{${CSI}33m%}~ %{${CSI}36m%}%h %{${CSI}35m%}%03. %(?::%{${CSI}32m%}%? )%{${CSI}0m%}> %(#.#.)"

Where 18328 is my numeric userid. 

Note that the ^[ is actually a quoted ESC put in by vi : I can't
remember if I managed to get it working with \033, but I'd guess not
judging by that ESC :)

Sorry I haven't explained much, but I've gotta go - no doubt some of the
other readers of the list will go into more detail...




-- 
Wez - Electronics Undergraduate at the University of York
URL : http://www.twinklestar.demon.co.uk/

Insult Of The Day: Thou mammering tardy-gaited death-token!



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