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

Re: Completion damaging prompt



"Renato Botelho" wrote:
> I'm using zsh 4.3.6 at FreeBSD 7.0, and I noted a problem with prompt
> in some cases,
> following is an example
> 
> garga@botelhor:~> sudo su
> 
> root@botelhor:/home/garga#
> 
> root@botelhor:/home/garga# pkg<TAB>
>..
> And if I clear the screen using ^L prompt changes to ~garga
> 
> root@botelhor:~garga#

That means something, somewhere in shell code is referring to your home
directory as ~garga (which would expand to /home/garga).  After that's
happened once it's treated as a candidate for abbreviation wherever name
directories are valid.  You have various choices:

- If you want to track down what it is, you'll probably need to get
the completion system to output debug information with "^X?".  This
could be time-consuming to get completely to the bottom of.

- If you always want directories to be shown in full, you can replace
%~ in your path with %/.  That will show /home/garga instead of ~ when
you're not root, however.

- If you want the prompt to be abbreviated only when you're not root,
you can change it to

PROMPT='%n@%B%m%b:%(#.%/#.%~>) '

- If you're happy with your home directory always being abbreviated when
you're root, so that at least it doesn't change, you can put a reference
to it in the initialisation file:

: ~garga

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070



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