delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/01/15/10:51:57

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <gkmjno$h62$2@ger.gmane.org>
References: <496A5EDE DOT 9010204 AT veritech DOT com> <496A7038 DOT 402 AT gmail DOT com> <496B7C25 DOT 3090705 AT veritech DOT com> <496E528D DOT 1090801 AT gmail DOT com> <gkm9u9$qp2$1 AT ger DOT gmane DOT org> <496EC898 DOT 1090504 AT gmail DOT com> <gkmjno$h62$2 AT ger DOT gmane DOT org>
Date: Thu, 15 Jan 2009 10:49:27 -0500
Message-ID: <17393e3e0901150749sf20dd7em7af71ea7e7fd4834@mail.gmail.com>
Subject: Re: keycodes
From: Matt Wozniski <godlygeek AT gmail DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Thu, Jan 15, 2009 at 1:05 AM, Andrew DeFaria wrote:
> Andy Koppe wrote:
>> Andrew DeFaria wrote:
>>>>>  > "\e[1;5A": history-search-backward
>>>>>  > "\e[1;5B": history-search-forward
>>>>>
>>>>> Perhaps I don't understand this 'bash' feature, but it doesn't seem to
>>>>> work for me.
>>>>
>>>> Start typing a command, press Ctrl-Up, and it finds the previous line in
>>>> the history that started like that.
>>>
>>> Why not simply type Ctrl-R then the first few letters of a command (or
>>> some letters in the middle of a command). Works great! Requires no support
>>> from any terminal emulator...
>>
>> Yes, obviously you can bind the history search to any key you like.
>
> The points were, since you seemed to have missed them, that 1) that's the
> default binding for bash

It's a default binding for bash that does something different than the
suggested binding.  It's great that you can do both, but they're not
the same.  I know of both, use both, and find history-search-backward
and history-search-forward much more useful more of the time than
reverse-search-history and forward-search-history.

> and 2) it doesn't require MinTTY, nor xterm, nor
> any particular terminal emulator. IOW it works out of the box, in fact works
> in Cygwin's bash Windows console window

It works with all terminal emulators that are set up to send CTRL+R as
the single byte 0x12 - nearly all do by default, but there's no reason
they have to.  xterm can be configured to send CSI 27;5;114 ~
instead.  Andy's suggestion works with all terminal emulators that
send CSI 1;5 A for CTRL+UP - again, most do, but not all.  There's no
difference between the two here, apart from one binding being default
and the other being added with .inputrc.

> and does not even restrict you to
> locating only the start of a command. All win, win, win situations as I see
> it.

The fact that it's "restricted" to only working at the start of the
line is why it's more useful more of the time for me.  I sometimes
want to find a command that contained 'foobar' as one of its arguments
somewhere on the line - but, much more often, I want to find that
cryptic ctags invocation, or that find command, etc.  If I know what
the line begins with, then searching with CTRL+R just gives me false
positives that I need to skip over.

~Matt

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019