minor vi/vim qstn

Gary Kline kline at thought.org
Thu Sep 26 20:59:50 UTC 2013


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:
> 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

	
	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!


> 
> 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 ..."). :-)
> 
> 
	I'll be typing for 10 years before I'v saved the keystrokes ive
	spent here

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

-- 
 Gary Kline  kline at thought.org  http://www.thought.org  Public Service Unix
             Twenty-seven years of service to the Unix community.
                            http://www.thought.org/HOPE




More information about the freebsd-questions mailing list