Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Sep 2013 00:12:46 +0200
From:      Polytropon <freebsd@edvax.de>
To:        Gary Kline <kline@thought.org>
Cc:        FreeBSD Mailing List <freebsd-questions@freebsd.org>
Subject:   Re: minor vi/vim qstn
Message-ID:  <20130927001246.b2d12d91.freebsd@edvax.de>
In-Reply-To: <20130926205819.GB24184@ethic.thought.org>
References:  <20130925212741.GA19434@ethic.thought.org> <20130926002327.6502d1b9.freebsd@edvax.de> <20130926002104.GA12932@ethic.thought.org> <20130926030600.8850ddc5.freebsd@edvax.de> <20130926024708.GA3908@ethic.thought.org> <20130926152629.89e6dd72.freebsd@edvax.de> <20130926195132.GA24184@ethic.thought.org> <20130926220506.d9c11563.freebsd@edvax.de> <20130926205819.GB24184@ethic.thought.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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'
> HISTSIZE=1000
> 
> 
> 	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. :-)





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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130927001246.b2d12d91.freebsd>