zsh-users
 help / color / mirror / code / Atom feed
* CHASE_LINKS and PS1
@ 2019-11-13 10:55 ` Seb
  2019-11-13 11:35   ` Peter Stephenson
  0 siblings, 1 reply; 7+ messages in thread
From: Seb @ 2019-11-13 10:55 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 463 bytes --]


Hi,


Setting the option CHASE_LINKS disables the %~ shortcut in PS1:

~/tmp> export PS1="%~> "
~/tmp> mkdir sd
~/tmp> cd sd && cd -
~/tmp
~/tmp> setopt CHASE_LINKS
~/tmp> cd sd && cd -
/raid/home/seb/tmp
/raid/home/seb/tmp>

This is unfortunate. 
Is it a feature or a bug? 
If a feature, is there a way around it? I'd like both CHASE_LINKS and %~.
I searched the ML's archive, the manual and the guide but did not find
enlightenment.


Kind regards,
Sébastien.

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

* Re: CHASE_LINKS and PS1
  2019-11-13 10:55 ` CHASE_LINKS and PS1 Seb
@ 2019-11-13 11:35   ` Peter Stephenson
  2019-11-13 12:00     ` Seb
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Stephenson @ 2019-11-13 11:35 UTC (permalink / raw)
  To: zsh-users

On Wed, 2019-11-13 at 11:55 +0100, Seb wrote:
> Setting the option CHASE_LINKS disables the %~ shortcut in PS1:

That's not a general effect.  Is there e.g. an automounter on
your system that means home directories are in fact links?
The /raid in the path certainly looks a bit suspicious...

pws



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

* Re: CHASE_LINKS and PS1
  2019-11-13 11:35   ` Peter Stephenson
@ 2019-11-13 12:00     ` Seb
  2019-11-14 13:42       ` Peter Stephenson
  0 siblings, 1 reply; 7+ messages in thread
From: Seb @ 2019-11-13 12:00 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 794 bytes --]


Hi,


>> Setting the option CHASE_LINKS disables the %~ shortcut in PS1:
> That's not a general effect.  Is there e.g. an automounter on your 
> system that means home directories are in fact links? The /raid in the 
> path certainly looks a bit suspicious...

Ah yes, /home is indeed a symlink to /raid/home.

I understand now: $HOME is /home/seb and because of CHASE_LINKS, pwd says 
that I am in /raid/home/seb. I added HOME=/raid/home/seb in ~/.zshenv 
and the problem is almost solved: the prompt is correct except when a 
terminal is first opened, as show below:

/home/seb>cd
~>

I tried a workaround with:
 	urxvt -e sh -c '/usr/bin/zsh'
but I do not manage to tell zsh to execute "cd && clear".
Is there a way to do this?
Or perhaps a better way all around?


Thanks alot!
Sébastien.

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

* Re: CHASE_LINKS and PS1
  2019-11-13 12:00     ` Seb
@ 2019-11-14 13:42       ` Peter Stephenson
  2019-11-14 16:48         ` Seb
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Stephenson @ 2019-11-14 13:42 UTC (permalink / raw)
  To: zsh-users

On Wed, 2019-11-13 at 13:00 +0100, Seb wrote:
> I tried a workaround with:
>  	urxvt -e sh -c '/usr/bin/zsh'
> but I do not manage to tell zsh to execute "cd && clear".
> Is there a way to do this?
> Or perhaps a better way all around?

While I haven't got anything particularly clever, I presume
you've thought of simply adding that to ~/.zshrc?  Or even
add it to ~/.zlogin and execute

urxvt -e /usr/bin/zsh -l

to start a login shell?

pws


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

* Re: CHASE_LINKS and PS1
  2019-11-14 13:42       ` Peter Stephenson
@ 2019-11-14 16:48         ` Seb
  2019-11-14 16:59           ` Daniel Shahaf
  0 siblings, 1 reply; 7+ messages in thread
From: Seb @ 2019-11-14 16:48 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 270 bytes --]


> While I haven't got anything particularly clever, I presume you've 
> thought of simply adding that to ~/.zshrc?

Aww... I hadn't realized that ~/.zshrc is indeed a list of commands.
'cd' is now added at the end of the file and all is well.


Many thanks!
Sébastien.

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

* Re: CHASE_LINKS and PS1
  2019-11-14 16:48         ` Seb
@ 2019-11-14 16:59           ` Daniel Shahaf
  2019-11-15 16:29             ` Seb
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Shahaf @ 2019-11-14 16:59 UTC (permalink / raw)
  To: zsh-users

Seb wrote on Thu, 14 Nov 2019 16:48 +00:00:
> 
> > While I haven't got anything particularly clever, I presume you've 
> > thought of simply adding that to ~/.zshrc?
> 
> Aww... I hadn't realized that ~/.zshrc is indeed a list of commands.
> 'cd' is now added at the end of the file and all is well.

This will cd to the homedir even if you start zsh from elsewhere.  You
might want something like «if [[ -e ./.is_my_homedir ]]; then cd; fi».
(Create that file manually, once.)

If your zsh is new enough to support «print -v», you can also do:

    if print -v tmp -Pr %~; [[ $tmp == '/home/seb' ]]; then cd; fi
    unset tmp

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

* Re: CHASE_LINKS and PS1
  2019-11-14 16:59           ` Daniel Shahaf
@ 2019-11-15 16:29             ` Seb
  0 siblings, 0 replies; 7+ messages in thread
From: Seb @ 2019-11-15 16:29 UTC (permalink / raw)
  To: Daniel Shahaf; +Cc: zsh-users

[-- Attachment #1: Type: text/plain, Size: 233 bytes --]


Hi Daniel,


> This will cd to the homedir even if you start zsh from elsewhere.  You 
> might want something like «if [[ -e ./.is_my_homedir ]]; then cd; fi». 
> (Create that file manually, once.)

Good idea, thanks!


Sébastien.


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

end of thread, other threads:[~2019-11-15 16:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20191113105638eucas1p2ce334c013381831d982c583aa35cf253@eucas1p2.samsung.com>
2019-11-13 10:55 ` CHASE_LINKS and PS1 Seb
2019-11-13 11:35   ` Peter Stephenson
2019-11-13 12:00     ` Seb
2019-11-14 13:42       ` Peter Stephenson
2019-11-14 16:48         ` Seb
2019-11-14 16:59           ` Daniel Shahaf
2019-11-15 16:29             ` Seb

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).