From owner-freebsd-questions@FreeBSD.ORG Thu Sep 26 20:59:49 2013 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id D2E56D9B for ; Thu, 26 Sep 2013 20:59:49 +0000 (UTC) (envelope-from kline@thought.org) Received: from p3plsmtpa11-09.prod.phx3.secureserver.net (p3plsmtpa11-09.prod.phx3.secureserver.net [68.178.252.110]) by mx1.freebsd.org (Postfix) with ESMTP id 7210B2A91 for ; Thu, 26 Sep 2013 20:59:49 +0000 (UTC) Received: from ethic.thought.org ([209.180.213.209]) by p3plsmtpa11-09.prod.phx3.secureserver.net with id VwyC1m00G4XeM0101wyCBs; Thu, 26 Sep 2013 13:58:13 -0700 Date: Thu, 26 Sep 2013 13:58:19 -0700 From: Gary Kline To: Polytropon Subject: Re: minor vi/vim qstn Message-ID: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130926220506.d9c11563.freebsd@edvax.de> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: FreeBSD Mailing List X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Sep 2013 20:59:50 -0000 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@thought.org http://www.thought.org Public Service Unix Twenty-seven years of service to the Unix community. http://www.thought.org/HOPE