svn commit: r325092 - head/usr.bin/fortune/datfiles

Devin Teske devin at shxd.cx
Tue Oct 31 03:59:37 UTC 2017


> On Oct 30, 2017, at 2:35 PM, Dan Mack <mack at macktronics.com> wrote:
> 
> Devin Teske <devin at shxd.cx> writes:
> 
>> Better in bash which allows you to filter not only on "begins with"
>> but also "contains" (which is arguably more valuable than "begins
>> with").
> 
> Definately different. Better? Maybe for some.  I most always search
> command history by prefix and then just using multiple ESC-p invocations
> to find the one command to edit/re-execute.  Less frequently I want to
> search the whole text of history for the whole command line sequence
> like bash Ctrl-R accomplishes.
> 
>>>> To emulate this behaviour in bash, I simply create a .inputrc file in my
>>>> $HOME with the following contents:
>>>> 
>>>> # .inputrc file
>>>> "\ep": history-search-backward
>>>> "\en": history-search-forward
> 
>> Interesting that you mapped these to cursor-up/cursor-down.
>> 
>> That may cause unexpected results.
> 
>> For example, typing something and then pressing up-arrow will cause
>> the shell to give you the previous command that started with that
>> rather than the previous command in-general.
> 
> It's ESC-p/ESC-n, not just plain up-arrow/down-arrow.  

You cut too important context from your reply. Before I said "Interesting that you mapped ...", ...

> On Oct 30, 2017, at 8:16 AM, Alexey Dokuchaev <danfe at FreeBSD.org> wrote:
> 
> On GNU/Linux boxes mine has:
> 
> "\e[A": history-search-backward
> "\e[B": history-search-forward

And according to wikipedia:

https://en.m.wikipedia.org/wiki/ANSI_escape_code

Under "CSI Sequences" ...

\e[A is really "cursor up" (CUU; with syntax of CSI [n] A)

\e[B is really "cursor down" (CUD; with syntax of CSI [n] B)

NB: CSI is \e[

> Up arrow still
> does up without any search.

Not if you do what danfe did above, in the restored context.


> At least with my config using \ep as shown.
> My up arrows work for me as expected - they just iterate forward and
> backward through shell history.
> 

That is expected behavior.
-- 
Devin


More information about the svn-src-head mailing list