View previous topic :: View next topic |
Author |
Message |
tobr Guru
Joined: 29 May 2006 Posts: 330
|
Posted: Fri Nov 24, 2006 11:47 pm Post subject: Bash completion based on history [solved] |
|
|
Hi.
If I use bash in gentoo and type something like this (where _ is the cursor position and $ is the prompt):
Code: | $ ls -l /var/log
$ ls_ |
and I type PgUp it completes this line from history (in this case it will show "ls -l /var/log") and you can scroll through older completions with subsequent PgUps.
What I want to know is how this is done (because I'd like to have it on other systems too) and how I can change the default binding from PgUp/PgDown to ArrowUp/ArrowDown (csh on FreeBSD does this by default) which I like better.
I searched ~/.bashrc /etc/bash/* /etc/profile /etc/bash_completion* without finding anything relating to this. The bash man page wasn't that helpful either, I only found stuff about using "!". So if anyone could point me in the right direction or provide any insights it would be appreciated.
Last edited by tobr on Sat Nov 25, 2006 12:20 am; edited 1 time in total |
|
Back to top |
|
|
erik258 Advocate
Joined: 12 Apr 2005 Posts: 2650 Location: Twin Cities, Minnesota, USA
|
|
Back to top |
|
|
tobr Guru
Joined: 29 May 2006 Posts: 330
|
Posted: Sat Nov 25, 2006 12:19 am Post subject: |
|
|
Argh. Of course I looked in the completely wrong place. It's a setting in /etc/inputrc or ~/.inputrc. The originial setting is
Code: | "\e[5~": history-search-backward
"\e[6~": history-search-forward
|
which will do the described thing with PgUP/PgDown and my new setting is
Code: | "\e[A": history-search-backward
"\e[B": history-search-forward
|
which does the trick with the arrows. |
|
Back to top |
|
|
erik258 Advocate
Joined: 12 Apr 2005 Posts: 2650 Location: Twin Cities, Minnesota, USA
|
Posted: Sat Nov 25, 2006 12:54 am Post subject: |
|
|
ah... i did not know about that file. .. interesting. _________________ Configuring a Firewall? Try my iptables configuration
LinuxCommando.com is my blog for linux-related scraps and tidbits. Stop by for a visit! |
|
Back to top |
|
|
|