zsh-users
 help / color / mirror / code / Atom feed
* Weird behaviour with exporting PATH
@ 2006-11-05 10:19 Stephan Windmüller
  2006-11-05 10:34 ` Stephane Chazelas
  0 siblings, 1 reply; 8+ messages in thread
From: Stephan Windmüller @ 2006-11-05 10:19 UTC (permalink / raw)
  To: zsh-users

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

Hello!

I am using zsh 4.3.2 from the debian backports and figured out some
strange behaviour when starting a zsh inside another zsh.

Line from .zshrc:

export PATH=$PATH:/home/user/path

Of course, at the first start all works fine. But when I start another
zsh and /home/user/path is listed twice in $PATH, my shell is acting
weird.

For example, pressing "Cursor up" calls the last history entry but
points the cursor at the first character (expected: after the last).
Pressing "<END>" then results in changing the first word to capital
letters.

What is going on here? And how do I fix it?

Regards
 Stephan

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: Weird behaviour with exporting PATH
  2006-11-05 10:19 Weird behaviour with exporting PATH Stephan Windmüller
@ 2006-11-05 10:34 ` Stephane Chazelas
  2006-11-05 11:41   ` Stephan Windmüller
  0 siblings, 1 reply; 8+ messages in thread
From: Stephane Chazelas @ 2006-11-05 10:34 UTC (permalink / raw)
  To: Stephan Windmüller; +Cc: zsh-users

On Sun, Nov 05, 2006 at 11:19:20AM +0100, Stephan Windmüller wrote:
> Hello!
> 
> I am using zsh 4.3.2 from the debian backports and figured out some
> strange behaviour when starting a zsh inside another zsh.
> 
> Line from .zshrc:
> 
> export PATH=$PATH:/home/user/path
> 
> Of course, at the first start all works fine. But when I start another
> zsh and /home/user/path is listed twice in $PATH, my shell is acting
> weird.

PATH should be defined in your .profile as it's a setting for
your session, not for your shell only.

> For example, pressing "Cursor up" calls the last history entry but
> points the cursor at the first character (expected: after the last).
> Pressing "<END>" then results in changing the first word to capital
> letters.
> 
> What is going on here? And how do I fix it?
[...]

That indicates you are in vi mode. It shouldn't be related to
$PATH. What is possible is that you have a bindkey -e (for
switching to emacs mode) in .profile, .zprofile, .zlogin,
/etc/profile, /etc/zprofile or /etc/zlogin instead of .zshrc
(here, it's a shell setting).

Adding:

bindkey -e 

to your ~/.zshrc should force the emacs mode. zsh may have
chosen vi mode by default because you have the $VISUAL or
$EDITOR variable set to vi.

-- 
Stéphane


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

* Re: Weird behaviour with exporting PATH
  2006-11-05 10:34 ` Stephane Chazelas
@ 2006-11-05 11:41   ` Stephan Windmüller
  2006-11-05 12:12     ` Frank Terbeck
  0 siblings, 1 reply; 8+ messages in thread
From: Stephan Windmüller @ 2006-11-05 11:41 UTC (permalink / raw)
  To: zsh-users

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

On Sun, 05. Nov 2006, Stephane Chazelas wrote:

> PATH should be defined in your .profile as it's a setting for your
> session, not for your shell only.

This file is not processed on my system. Do I have to source it
manually?

> That indicates you are in vi mode. It shouldn't be related to
> $PATH.

You are right, it is not related to $PATH. One line after setting it,
$EDITOR is set to vim. Sorry for confusing.

> Adding:
> bindkey -e 
> to your ~/.zshrc should force the emacs mode.

Thank you, that helped. But is there a "vim"-mode instead of vi? I did
not find it in the documentation.

Regards
 Stephan

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: Weird behaviour with exporting PATH
  2006-11-05 11:41   ` Stephan Windmüller
@ 2006-11-05 12:12     ` Frank Terbeck
  2006-11-05 12:22       ` Stephan Windmüller
  2006-11-05 12:35       ` Stephane Chazelas
  0 siblings, 2 replies; 8+ messages in thread
From: Frank Terbeck @ 2006-11-05 12:12 UTC (permalink / raw)
  To: zsh-users

Stephan Windmüller <windy@white-hawk.de>:
> On Sun, 05. Nov 2006, Stephane Chazelas wrote:
> 
> > PATH should be defined in your .profile as it's a setting for your
> > session, not for your shell only.
> 
> This file is not processed on my system. Do I have to source it
> manually?

Stephane probably meant '.zprofile', see
<http://zsh.dotsrc.org/Doc/Release/zsh_4.html#SEC17>.
To wipe out duplicates from $PATH you could also issue this command:
% typeset -U path

[...]
> > Adding:
> > bindkey -e 
> > to your ~/.zshrc should force the emacs mode.
> 
> Thank you, that helped. But is there a "vim"-mode instead of vi? I did
> not find it in the documentation.

Nope, there is no 'vim' Mode.
See <http://zsh.dotsrc.org/Doc/Release/zsh_17.html#SEC92>.

Regards, Frank


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

* Re: Weird behaviour with exporting PATH
  2006-11-05 12:12     ` Frank Terbeck
@ 2006-11-05 12:22       ` Stephan Windmüller
  2006-11-05 12:56         ` Vincent Lefevre
  2006-11-05 13:20         ` Stephane Chazelas
  2006-11-05 12:35       ` Stephane Chazelas
  1 sibling, 2 replies; 8+ messages in thread
From: Stephan Windmüller @ 2006-11-05 12:22 UTC (permalink / raw)
  To: zsh-users

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

On Sun, 05. Nov 2006, Frank Terbeck wrote:

> > This file is not processed on my system. Do I have to source it
> > manually?
> Stephane probably meant '.zprofile', see
> <http://zsh.dotsrc.org/Doc/Release/zsh_4.html#SEC17>.

Ah, but this is only sourced for login-shells.

> To wipe out duplicates from $PATH you could also issue this command:
> % typeset -U path

That does exactly what I expected. Thank you!

Regards
 Stephan

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: Weird behaviour with exporting PATH
  2006-11-05 12:12     ` Frank Terbeck
  2006-11-05 12:22       ` Stephan Windmüller
@ 2006-11-05 12:35       ` Stephane Chazelas
  1 sibling, 0 replies; 8+ messages in thread
From: Stephane Chazelas @ 2006-11-05 12:35 UTC (permalink / raw)
  To: zsh-users

On Sun, Nov 05, 2006 at 01:12:08PM +0100, Frank Terbeck wrote:
> Stephan Windmüller <windy@white-hawk.de>:
> > On Sun, 05. Nov 2006, Stephane Chazelas wrote:
> > 
> > > PATH should be defined in your .profile as it's a setting for your
> > > session, not for your shell only.
> > 
> > This file is not processed on my system. Do I have to source it
> > manually?
> 
> Stephane probably meant '.zprofile', see
> <http://zsh.dotsrc.org/Doc/Release/zsh_4.html#SEC17>.
> To wipe out duplicates from $PATH you could also issue this command:
> % typeset -U path

Actually, I thought .profile was read if .zprofile was not
there.

I would suggest to do a

ln -s .profile ~/.zprofile

and keep the syntax of .profile portable so that your session
settings are preserved ifever you decide to change your login
shell to another Bourne like shell.

> [...]
> > > Adding:
> > > bindkey -e 
> > > to your ~/.zshrc should force the emacs mode.
> > 
> > Thank you, that helped. But is there a "vim"-mode instead of vi? I did
> > not find it in the documentation.
> 
> Nope, there is no 'vim' Mode.
> See <http://zsh.dotsrc.org/Doc/Release/zsh_17.html#SEC92>.
[...]

It should be noted that zsh doesn't call vi nor any shared
library common to vi. The vi mode is a vi-like mode, it doesn't
implement the full vi interface only a subset of the insert and
command mode (no ex mode) with additions.

Given that vim is a superset of vi, zsh vi-mode could also be
called vim-mode, as it also implements a subset of the vim
interface.

And if there are features from vim you are missing in zsh vi
mode, it's quite easy to extend it.

For instance, if the <End> key doesn't work for you, you can
probably do something like:

bindkey $terminfo[kend]  end-of-line

(if it worked for you in emacs mode, it's probably that you have
that line (or similar) already in one of your startup files, but
that it was applied only to the emacs keymap).

-- 
Stéphane


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

* Re: Weird behaviour with exporting PATH
  2006-11-05 12:22       ` Stephan Windmüller
@ 2006-11-05 12:56         ` Vincent Lefevre
  2006-11-05 13:20         ` Stephane Chazelas
  1 sibling, 0 replies; 8+ messages in thread
From: Vincent Lefevre @ 2006-11-05 12:56 UTC (permalink / raw)
  To: zsh-users

On 2006-11-05 13:22:39 +0100, Stephan Windmüller wrote:
> On Sun, 05. Nov 2006, Frank Terbeck wrote:
> 
> > > This file is not processed on my system. Do I have to source it
> > > manually?
> > Stephane probably meant '.zprofile', see
> > <http://zsh.dotsrc.org/Doc/Release/zsh_4.html#SEC17>.
> 
> Ah, but this is only sourced for login-shells.

Yes, and it is sourced after ".zshenv", while one may need to set $PATH
before some commands in ".zshenv". For instance:

head -1 /dev/null 2>/dev/null || export _POSIX2_VERSION=199209

-- 
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)


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

* Re: Weird behaviour with exporting PATH
  2006-11-05 12:22       ` Stephan Windmüller
  2006-11-05 12:56         ` Vincent Lefevre
@ 2006-11-05 13:20         ` Stephane Chazelas
  1 sibling, 0 replies; 8+ messages in thread
From: Stephane Chazelas @ 2006-11-05 13:20 UTC (permalink / raw)
  To: Stephan Windmüller; +Cc: zsh-users

On Sun, Nov 05, 2006 at 01:22:39PM +0100, Stephan Windmüller wrote:
> On Sun, 05. Nov 2006, Frank Terbeck wrote:
> 
> > > This file is not processed on my system. Do I have to source it
> > > manually?
> > Stephane probably meant '.zprofile', see
> > <http://zsh.dotsrc.org/Doc/Release/zsh_4.html#SEC17>.
> 
> Ah, but this is only sourced for login-shells.

Yes, that's why/because it's a session configuration file.
There, you put the definition of the environment variables and
tty settings... that will affect your login session.

Environment variables and tty settings are inherited by all the
processes started during the session (whose common ancestors are
your login shell).

> > To wipe out duplicates from $PATH you could also issue this command:
> > % typeset -U path
> 
> That does exactly what I expected. Thank you!
[...]

It would make more sense not to introduce duplicates in the
first place, that is to define PATH only once.

-- 
Stéphane


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

end of thread, other threads:[~2006-11-05 13:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-05 10:19 Weird behaviour with exporting PATH Stephan Windmüller
2006-11-05 10:34 ` Stephane Chazelas
2006-11-05 11:41   ` Stephan Windmüller
2006-11-05 12:12     ` Frank Terbeck
2006-11-05 12:22       ` Stephan Windmüller
2006-11-05 12:56         ` Vincent Lefevre
2006-11-05 13:20         ` Stephane Chazelas
2006-11-05 12:35       ` Stephane Chazelas

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