Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Sep 2013 22:05:06 +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:  <20130926220506.d9c11563.freebsd@edvax.de>
In-Reply-To: <20130926195132.GA24184@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>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 26 Sep 2013 12:51:32 -0700, Gary Kline wrote:
> 	my zsh does a default to 10  or so history with just 
> 
> 	% h 
> 
> 	I was trying to remember how to set it to ,, say, 100.  

Depending on _typical_ terminal heights (100 lines?), this
seems to be a bit high. But I assume zsh handles the "h"
alias similarly to the csh, where an alias is defined
(system-wide in /etc/csh.cshrc or per user in ~/.cshrc).
Look for ~/.zshrc (if I remember correctly):

	alias	h	'history 25'

and change it accordingly. An interactive change is also
possible (but will only be kept for the current session).

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

Probably zsh has something similar.



> 	(for as many centuries as ive been using vi [nvi], there are
> 	*still* things I never had need to learn.  so it turns out that 
> 	a lot of theses "clever" sh scripts are over my head ....  it
> 	takes mins -> hours to figure out.

You notice that you're saying that to a programmer whose
shell scripts are usually overcomplicated, dull, and could
use lots of optimization? ;-)



> > 	% history 20 | awk 'BEGIN {cmds=20} { printf("\t%2d\t%s\n", -(cmds-i), $0); i++ }' | grep -v "history"
> > 
> > It might be good to define a better exclusion pattern than just
> > "history" because that might lead to false-positives. I'd suggest
> > to rename the variables in the awk script to something unique and
> > then grep for those instead...
> > 
> 	I have grep -v aliased to grv.  

If you're using that alias inside another alias, zsh (if it
acts like csh) will expand it properly. Using such an alias
in a "one-time entry" (as I'd consider an addition to a
configuration file) still doesn't sound optimal regarding
readability and maintainability. As if we would ever maintain
our "naturally grown" (over centuries) configuration files... ;-)

Still I think turning the example into a shell alias ("h20") or
assigning it (with 20 -> 10) to the "precmd" alias could not
be trivial, at least regarding the C shell, because lots of
quoting and escaping would be needed; maybe zsh does not behave
like a madman in this regards ("unmatched this, unmatched that,
sytax error, cannot expand, missing argument, blah ..."). :-)




-- 
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?20130926220506.d9c11563.freebsd>