From owner-svn-src-head@freebsd.org Mon Oct 30 18:45:06 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6FCCE63B49; Mon, 30 Oct 2017 18:45:06 +0000 (UTC) (envelope-from devin@shxd.cx) Received: from shxd.cx (mail.shxd.cx [64.201.244.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A56BC6DF3A; Mon, 30 Oct 2017 18:45:06 +0000 (UTC) (envelope-from devin@shxd.cx) Received: from [64.201.244.132] (port=55478 helo=[10.0.0.105]) by shxd.cx with esmtps (TLSv1:AES256-SHA:256) (Exim 4.77 (FreeBSD)) (envelope-from ) id 1e9DAv-000HGV-1V; Mon, 30 Oct 2017 16:44:33 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r325092 - head/usr.bin/fortune/datfiles From: Devin Teske X-Mailer: iPhone Mail (13G36) In-Reply-To: Date: Mon, 30 Oct 2017 11:45:04 -0700 Cc: Cy Schubert , "src-committers@freebsd.org" , Eitan Adler , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" , Ed Maste , Warner Losh Content-Transfer-Encoding: quoted-printable Message-Id: <40AC7875-A7AF-4323-B6A6-0936C0507761@shxd.cx> References: <201710291851.v9TIpM0I073542@slippy.cwsent.com> To: Dan Mack X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Oct 2017 18:45:06 -0000 > On Oct 30, 2017, at 7:47 AM, Dan Mack wrote: >=20 > Devin Teske writes: >=20 > >=20 >>> Or better yet, ctrl-r in bash and zsh, or up-arrow in tcsh. >>=20 >> Since we are responding to emaste's astute observation with random >> personal favorites when it comes to history actions in an interactive >> shell... >>=20 >> How about Esc-P and Esc-N? >=20 > In continuation of the tangent --- >=20 > I use ESC-P / ESC-N a lot; it's a neat feature that tcsh has had for a > long time, maybe since the beginning. However it's a tcsh feature, not > sh, bash, or csh IIRC. But csh is actually tcsh on FreeBSD but I'm sure > most people already know this on this list. zsh's default implementation matches that of tcsh. csh would likely support it, but since /bin/csh and /bin/tcsh are hard links= to each other, can't tell for certain. That being said... It actually works better in bash without your (below) inputrc change. [t]csh, zsh, and bash implement this feature but bash implements it better t= han the others, though most people presume bash doesn't support it because i= t has to be used differently. > To emulate this behaviour in bash, I simply create a .inputrc file in my > $HOME with the following contents: >=20 > # .inputrc field > "\ep": history-search-backward > "\en": history-search-forward >=20 >=20 > Works for me. You probably won't want this for bash once you learn how to use bash's defau= lt implementation of Esc-N / Esc-P. Putting those (above) lines into ~/.inputrc may indeed make bash's Esc-N / E= sc-P behave like tcsh's/zsh's implementation, but bash's default implementat= ion is better, imho (see below) In tcsh/zsh: 1. Type letters that a previous cmd *begins with* 2. Esc-P In bash: 1. Esc-P (a ":" prompt appears) 2. Type letters that a previous cmd *contains* (or use ^ prefix for *begins-= with*) If you try to use bash's implementation in the tcsh/zsh way, you might be mi= sled into thinking "nothing happened" because if the input line is not empty= in bash, Esc-P does nothing. The [t]csh/zsh implementation is limited to only searching for previous comm= ands that start with something whilst the bash implementation allows searchi= ng for either text contained anywhere within a command or (if you put ^ as t= he first character) text that is at the start of a command. Being able to search anywhere within a command or at the beginning, I feel, m= akes the default bash implementation far more valuable than the one in [t]cs= h/zsh; and thus I get very sad when people make the bash implementation emul= ate [t]csh's/zsh's. --=20 Cheers, Devin