minor vi/vim qstn

Polytropon freebsd at edvax.de
Thu Sep 26 22:12:56 UTC 2013

On Thu, 26 Sep 2013 13:58:19 -0700, Gary Kline wrote:
> Organization: Thought Unlimited.  Public service Unix since 1986.
> Of_Interest: With 27 years  of service  to the  Unix  community.
> On Thu, Sep 26, 2013 at 10:05:06PM +0200, Polytropon wrote:
> > I also assume the zsh has some settings on how many commands
> > should be kept in history. The system's /etc/csh.cshrc provides
> > the csh's equivalent:
> > 
> > 	set history = 100
> > 	set savehist = 100
> 	I'remember seeing this a long time ago.  in my ~/.zshrc I've got
> 	iit in all CAPS. 
> HISTFILE=~/.zhistory 
> SAVEHIST='5000'
> 	got to google this; been tooo long since I glanced  at the code!

That's probably correct, it reflects the "sh-like aspects"
of code (as I said, csh is a terrible scripting shell, and
this is also true regarding its configuration files). So
those entries look correct.

I'm not a zsh user, so I can't say this for sure. I'm heavily
infected with csh already. ;-)

On Thu, 26 Sep 2013 14:15:17 -0700, Gary Kline wrote:
> 	FWIW, I just tried:
> 	alias -- h='history 50'
> 	works as it ought; last time I tried, the history quit 
> 	after ~10.  [?]

The reason might be that the history, at this point in time,
did only contain 10 entries. I don't know how the content
of ~/.zhistory behaves if more than one shell is running
for a given user...

The Z shell is very customizable and can automate routine
tasks (regarding the shell dialog) in a pleasant manner.
If you want the last 10 commands to be displayed before the
shell prompt appears, try something like this in ~/.zshrc:

function precmd {
	history 10 | awk 'BEGIN {histcmds=10} { printf("\t%2d\t%s\n", -(histcmds-i), $0); i++ }' | grep -v "histcmds"

Not tested, but it seems to be much easier as zsh simply
defines a function "precmd" and doesn't require the user
to fight with quotes, doublequotes and escaping as csh
successfully does. :-)

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

More information about the freebsd-questions mailing list