From owner-freebsd-questions@FreeBSD.ORG Fri Sep 27 03:02:14 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 EE733981 for ; Fri, 27 Sep 2013 03:02:13 +0000 (UTC) (envelope-from prvs=1975dfca55=vogelke@pobox.com) Received: from us.af.mil (52vejx-mr-008.us.af.mil [131.9.254.142]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 91E902CFC for ; Fri, 27 Sep 2013 03:02:12 +0000 (UTC) Received: from ([131.9.40.227]) by 52vejx-mr-008.us.af.mil with SMTP id 20Z0FN1.87415943; Thu, 26 Sep 2013 21:39:18 -0500 Received: (qmail 27987 invoked by uid 583); 27 Sep 2013 02:46:56 -0000 From: "Karl Vogel" Date: Thu, 26 Sep 2013 22:46:56 -0400 To: freebsd-questions@freebsd.org Subject: Re: minor vi/vim qstn Message-ID: <20130927024656.GA27195@amd118.wpafb.af.mil> 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) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: vogelke+unix@pobox.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Sep 2013 03:02:14 -0000 >> On Thu, Sep 26, 2013 at 10:05:06PM +0200, Polytropon wrote: P> Depending on _typical_ terminal heights (100 lines?), this [history P> setting] seems to be a bit high. But I assume zsh handles the "h" P> alias similarly to the csh, where an alias is defined (system-wide in P> /etc/csh.cshrc or per user in ~/.cshrc). The "fc" builtin can be helpful here. I like to see my recent history without numbering, so I can highlight/rerun/store any useful subset of commands: # history without command numbers, look for optional pattern. h () { case "$#" in 0) fc -ln 1 | less +G ;; *) fc -ln 1 | grep ${1+"$@"} ;; esac } If I dork up my history beyond belief, edit and reload the whole thing: histedit () { x="$HOME/.histedit" fc -W $x && vi $x && fc -R $x && rm $x } >> In a previous message: P> % history 20 | awk 'BEGIN {cmds=20} ... | grep -v "history" You can avoid some history pollution with these settings, at least in ZSH version 4.3.10: setopt histignoredups # don't store duplicate lines in command history setopt histnostore # don't store history commands in history Other settings I've found useful: setopt autocd # go to a directory if first word on command line # is not a command but is a directory setopt autoresume # single-word commands may resume a suspended job setopt cdablevars # allows cd'ing to a parameter setopt correct # try to correct the spelling of commands setopt csh_junkie_loops # allow short form of loops: list; end setopt extendedglob # allow # and ^ to be used for filename generation setopt extended_history # format: :: setopt globdots # don't require leading . in filename to be matched setopt ignoreeof # don't logout using Control-D setopt longlistjobs # list jobs in long format by default setopt markdirs # append trailing / to dirnames setopt menucomplete # cycle through completions when ambiguous setopt numeric_globsort # sort numeric filenames numerically setopt noclobber # don't overwrite existing files setopt notify # tell me when a job finishes setopt rcquotes # '' = single quote in single-quoted strings unsetopt bgnice # don't run background jobs at lower priority -- Karl Vogel I don't speak for the USAF or my company vogelke at pobox dot com http://www.pobox.com/~vogelke Teenage girl creates sustainable, renewable algae biofuel under her bed --Extreme Tech headline, 19 March 2013