Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Bash completion based on history [solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
tobr
Guru
Guru


Joined: 29 May 2006
Posts: 330

PostPosted: Fri Nov 24, 2006 11:47 pm    Post subject: Bash completion based on history [solved] Reply with quote

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
View user's profile Send private message
erik258
Advocate
Advocate


Joined: 12 Apr 2005
Posts: 2650
Location: Twin Cities, Minnesota, USA

PostPosted: Sat Nov 25, 2006 12:01 am    Post subject: Reply with quote

http://www.talug.org/events/20030709/cmdline_history.html

you should take a look; you might find it 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
View user's profile Send private message
tobr
Guru
Guru


Joined: 29 May 2006
Posts: 330

PostPosted: Sat Nov 25, 2006 12:19 am    Post subject: Reply with quote

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
View user's profile Send private message
erik258
Advocate
Advocate


Joined: 12 Apr 2005
Posts: 2650
Location: Twin Cities, Minnesota, USA

PostPosted: Sat Nov 25, 2006 12:54 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum