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

Re: HISTSIZE and prompt



Zhong, Kaixiang wrote:
:In .zshrc, I set HISTSIZE to 100, and it does store previous 100
:commands.
:However, when I type history, it only shows last 16 commands.
:Is there any other variables I should set?

>From the manual:
	history
		Same as fc -l
	fc .... [ first [last ] ]
		..... If  first is not specified, it will be set
		to -1 (the most recent event), or to -16 if the  -l
		flag is given .....


:Another thing I notices is:
:if I set 
:1) 'setopt cdablevars ' to enable that the argument of cd can be an env
:variable,
:2) prompt='%~>'
:3) mydir=/home/kzhong/dir/mydir
:after I 'cd ~mybin',  my prompt looks like "~mydir>"
:but if I change 3) to
:3) dir=/home/kzhong/dir/mydir
:and after I 'cd ~dir', my prompt looks like "~/dir/mydir" instead of
:"~dir".
:How can I make it looks like "~dir"?

I think there used to be (and may still be) something in the distribution
which was like this but with some other function name:

expanddir() { eval $1=$2; : ~$1 }

Then you would do:

% expanddir mydir /home/kzhong/dir/mydir

Of course, you could put some error checking in the function to check for the
right number of arguments, existance of $2 (and that it's a directory), etc.

>From the manual:
	: [ arg ... ]
		This command only expands parameters.  A zero exit
		code is returned.

Once you have used ``mydir'' as a named directory, ie. as ~mydir , it will be
used in your prompt as a named directory.

-- 
Geoff Wing [mason@xxxxxxxxxxxxxxx]   Technical Manager
  Phone    : +61-3-9818 2977         PrimeNet - Internet Consultancy
  Facsimile: +61-3-9819 3788         Web : <URL:http://www.primenet.com.au/>
  Mobile   : 0412 162 441



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