[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [nearly offtopic] Feature that makes easy to locate to similar previ
From: |
Pedro |
Subject: |
Re: [nearly offtopic] Feature that makes easy to locate to similar previous commands |
Date: |
Sun, 10 Mar 2013 03:40:13 +0100 |
On Fri, Mar 8, 2013 at 3:20 AM, Pedro <address@hidden> wrote:
> On Fri, Mar 8, 2013 at 2:49 AM, Stephen Montgomery-Smith
> <address@hidden> wrote:
>> http://stackoverflow.com/questions/1030182/how-do-i-change-bash-history-completion-to-complete-whats-already-on-the-line
>
> On Fri, Mar 8, 2013 at 3:09 AM, Jordi GutiƩrrez Hermoso
> <address@hidden> wrote:
>> On 7 March 2013 20:42, Pedro <address@hidden> wrote:
>>> Hi,
>>>
>>> Octave have a feature that when you put some commands, for example:
>>>
>>> version
>>> pkg list
>>> ls
>>>
>>> And if now you press "v" and later, the "up" arrow, you go to the
>>> first occurrence that start with "v", so this is "version" (more up
>>> arrow goes to more terms that start with "v").
>>> This is great.
>>>
>>> My question is if I can make this with simple bash commandline,
>>> editing something in .bashrc ?
>>
>> Both Octave and bash are using GNU readline, a common library for
>> command line editing. Octave binds <up> to readline's
>> history-search-backwards command by default:
>>
>>
>> http://hg.savannah.gnu.org/hgweb/octave/file/caf4f386aaab/scripts/startup/inputrc
>>
>> Just copy this file into your ~/.inputrc so that bash's readline also reads
>> it.
>
> @Jordi & @Stephen thanks for your help, that's what I was looking for.
There is a caution:
when you make your own ~/.inputrc you are overriding the default .inputrc
for example, after creating ~/.inputrc you can not make:
"\eOd": backward-word
"\eOc": forward-word
with arrows
it will get:
$ ;5C;5D
and where is inputrc default system file ?
in
/etc/inputrc
so you will need to make something like:
cp /etc/inputrc ~/.inputrc
and then copy that history-search-backward and forward