zsh-users
 help / color / mirror / code / Atom feed
* zsh prompt not updating until first 'chdir'
@ 2004-05-01 14:53 Timothy J. Luoma
  2004-05-01 16:14 ` Maurice
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Timothy J. Luoma @ 2004-05-01 14:53 UTC (permalink / raw)
  To: zsh-users


Hello folks
	Just back on the list after a long absence (exiled to Windows for a few  
years, just bought a Mac).

	I'm very rusty on my ZSH skills, and hope someone can help.  I have a  
$PROMPT setup in .zshenv

setprompt () { PROMPT="

---------------------------------%t/%T ---------------------------------
%S[OLDPWD: $OLDPWD]
      [PWD: %~]%s
$SHORT_HOST> "
}

chpwd () { setprompt }

this works fine AFTER my first chdir, but when I first login, it leaves me  
with the default prompt.

Can someone remind me what I have to do to get this to update as soon as I  
login?

Thanks!

TjL

ps - running ZSH 4.04, 4.06 and 4.1.1, fwiw



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: zsh prompt not updating until first 'chdir'
  2004-05-01 14:53 zsh prompt not updating until first 'chdir' Timothy J. Luoma
@ 2004-05-01 16:14 ` Maurice
  2004-05-01 17:52 ` Bart Schaefer
  2004-05-01 23:32 ` Dan Nelson
  2 siblings, 0 replies; 7+ messages in thread
From: Maurice @ 2004-05-01 16:14 UTC (permalink / raw)
  To: zsh-users

"Timothy J. Luoma" <luomat@peak.org> (2004-05-01 11:53) wrote:
> this works fine AFTER my first chdir, but when I first login, it leaves me  
> with the default prompt.
> 
> Can someone remind me what I have to do to get this to update as soon as I  
> login?

For this, I have the following in my ~/.zshrc

  cd $PWD


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: zsh prompt not updating until first 'chdir'
  2004-05-01 14:53 zsh prompt not updating until first 'chdir' Timothy J. Luoma
  2004-05-01 16:14 ` Maurice
@ 2004-05-01 17:52 ` Bart Schaefer
  2004-05-03  1:30   ` Timothy J. Luoma
  2004-05-01 23:32 ` Dan Nelson
  2 siblings, 1 reply; 7+ messages in thread
From: Bart Schaefer @ 2004-05-01 17:52 UTC (permalink / raw)
  To: zsh-users

On May 1, 11:53am, Timothy J. Luoma wrote:
}
} chpwd () { setprompt }
} 
} Can someone remind me what I have to do to get this to update as soon as I  
} login?

I always just but a call to chpwd directly after the definition of chpwd in
my startup files.  There's no magical reason you can't call chpwd yourself.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: zsh prompt not updating until first 'chdir'
  2004-05-01 14:53 zsh prompt not updating until first 'chdir' Timothy J. Luoma
  2004-05-01 16:14 ` Maurice
  2004-05-01 17:52 ` Bart Schaefer
@ 2004-05-01 23:32 ` Dan Nelson
  2004-05-03  0:41   ` Timothy Luoma
  2 siblings, 1 reply; 7+ messages in thread
From: Dan Nelson @ 2004-05-01 23:32 UTC (permalink / raw)
  To: Timothy J. Luoma; +Cc: zsh-users

In the last episode (May 01), Timothy J. Luoma said:
> Just back on the list after a long absence (exiled to Windows for a
> few years, just bought a Mac).

There is a very nice cygwin port of zsh :)

> I'm very rusty on my ZSH skills, and hope someone can help.  I have a
> $PROMPT setup in .zshenv
> 
> setprompt () { PROMPT="
> 
> ---------------------------------%t/%T ---------------------------------
> %S[OLDPWD: $OLDPWD]
>      [PWD: %~]%s
> $SHORT_HOST> "
> }

Why not just set PROMPT to  

"
---------------------------------%t/%T ---------------------------------
%S[OLDPWD: $dirstack[1]]
     [PWD: %~]%s
$SHORT_HOST> "

in your .zshrc directly, setopt prompt_subst, and forget about
resetting it every time you cd?

-- 
	Dan Nelson
	dnelson@allantgroup.com


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: zsh prompt not updating until first 'chdir'
  2004-05-01 23:32 ` Dan Nelson
@ 2004-05-03  0:41   ` Timothy Luoma
  2004-05-03  6:55     ` Oliver Kiddle
  0 siblings, 1 reply; 7+ messages in thread
From: Timothy Luoma @ 2004-05-03  0:41 UTC (permalink / raw)
  To: Dan Nelson; +Cc: zsh-users


On May 1, 2004, at 7:32 PM, Dan Nelson wrote:

> In the last episode (May 01), Timothy J. Luoma said:
>> Just back on the list after a long absence (exiled to Windows for a
>> few years, just bought a Mac).
>
> There is a very nice cygwin port of zsh :)

Sssh!!  It was one of the reasons I said I had to get a Mac ;-)

Actually I just installed Cygwin not too long ago, but it just made me 
want to get a real Unix machine again.


>> I'm very rusty on my ZSH skills, and hope someone can help.  I have a
>> $PROMPT setup in .zshenv
>>
>> setprompt () { PROMPT="
>>
>> ---------------------------------%t/%T 
>> ---------------------------------
>> %S[OLDPWD: $OLDPWD]
>>      [PWD: %~]%s
>> $SHORT_HOST> "
>> }
>
> Why not just set PROMPT to
>
> "
> ---------------------------------%t/%T 
> ---------------------------------
> %S[OLDPWD: $dirstack[1]]
>      [PWD: %~]%s
> $SHORT_HOST> "
>
> in your .zshrc directly, setopt prompt_subst, and forget about
> resetting it every time you cd?

PROMPT="
---------------------------------%t/%T ---------------------------------
%S[OLDPWD: $dirstack[1]]
      [PWD: %~]%s
$SHORT_HOST> "

works great EXCEPT that OLDPWD doesn't get updated

TjL


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: zsh prompt not updating until first 'chdir'
  2004-05-01 17:52 ` Bart Schaefer
@ 2004-05-03  1:30   ` Timothy J. Luoma
  0 siblings, 0 replies; 7+ messages in thread
From: Timothy J. Luoma @ 2004-05-03  1:30 UTC (permalink / raw)
  To: Bart Schaefer, zsh-users

On Sat, 1 May 2004 17:52:06 +0000, Bart Schaefer  
<schaefer@brasslantern.com> wrote:

> On May 1, 11:53am, Timothy J. Luoma wrote:
> }
> } chpwd () { setprompt }
> }
> } Can someone remind me what I have to do to get this to update as soon  
> as I
> } login?
>
> I always just but a call to chpwd directly after the definition of chpwd  
> in
> my startup files.  There's no magical reason you can't call chpwd  
> yourself.

Well that worked.  Should have thought of that myself.

TjL


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: zsh prompt not updating until first 'chdir'
  2004-05-03  0:41   ` Timothy Luoma
@ 2004-05-03  6:55     ` Oliver Kiddle
  0 siblings, 0 replies; 7+ messages in thread
From: Oliver Kiddle @ 2004-05-03  6:55 UTC (permalink / raw)
  To: Timothy Luoma; +Cc: zsh-users

Timothy Luoma wrote:
> 
> > in your .zshrc directly, setopt prompt_subst, and forget about
> > resetting it every time you cd?
> 
> PROMPT="
> ---------------------------------%t/%T ---------------------------------
> %S[OLDPWD: $dirstack[1]]
>       [PWD: %~]%s
> $SHORT_HOST> "
> 
> works great EXCEPT that OLDPWD doesn't get updated

Use single quotes instead of double quotes (and don't forget the
prompt_subst option). With double quotes, the variables are expanded
straightaway which is why they don't update.

Oliver


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-05-03  6:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-01 14:53 zsh prompt not updating until first 'chdir' Timothy J. Luoma
2004-05-01 16:14 ` Maurice
2004-05-01 17:52 ` Bart Schaefer
2004-05-03  1:30   ` Timothy J. Luoma
2004-05-01 23:32 ` Dan Nelson
2004-05-03  0:41   ` Timothy Luoma
2004-05-03  6:55     ` Oliver Kiddle

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).