
Oct 30, '03 09:47:00AM • Contributed by: Anonymous
bind '"M-[A":history-search-backward' bind '"M-[B":history-search-forward'where M-[A is the up key and M-[B is the down key.
|
10.3: Assign arrow keys to history search in bash
![]() Oct 30, '03 09:47:00AM • Contributed by: Anonymous
With Panther, the default shell is now Bash. I had customized my tcsh shell using this hint
In bash you can get similar results by adding this to your .bash_profile
bind '"M-[A":history-search-backward' bind '"M-[B":history-search-forward'where M-[A is the up key and M-[B is the down key.
•
[23,983 views]
Hint Options
10.3: Assign arrow keys to history search in bash
Or, you could just do nothing at all since this is bash's default behaviour.
10.3: Assign arrow keys to history search in bash
Actually, bash's default behavior is to bind the up and down arrows to previous-history and next-history, not history-search-backward and history-search-forward.
10.3: Assign arrow keys to history search in bash
I accomplished this with
"\e[A": history-search-backward in my .inputrc. I think that's essentially equivalent. PS, don't forget to add these to your .inputrc while you're at it:
set show-all-if-ambiguous on ---
10.3: Assign arrow keys to history search in bash
I'd like to bind option-up and option-down to history-search-backward and history-search-forward, respectively, but can't figure out how.
10.3: Assign arrow keys to history search in bash
Hmm, did you try \\M-[A to protect the shell of interpreting the backslash? Or '\M-[A' ?
10.3: Assign arrow keys to history search in bash
I haven't been able to get this to work; i've added it to .bash_profile, opened new terminals, quit Terminal, and still no go.
10.3: Assign arrow keys to history search in bash
I could not get the suggestions here to work, I ended up doing the following.
Type this into vi ~/.bash_profile, and in place of type control + v, then up arrow. In place of type control + v then down arrow. (Control V tells vi to put the next character in the doc, rather than just moving up when you press up arrow etc.)
Then close all Terminal windows, and quit the app, then open Terminal again and you should have the feature.
10.3: Assign arrow keys to history search in bash
I had to use:
10.3: Assign arrow keys to history search in bash
I've assigned the commands to ⌥↑ and ⌥↓ instead. If you want the shortcuts to be available in other shells and programs, you can add them to ~/.inputrc (which is used to configure the same Readline keybindings and settings that can be set with the bind builtin). "\M-\e[A": history-search-backward "\M-\e[B": history-search-forward Edited on Jun 11, '12 02:57:49AM by Lri
|
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysNo new commentsLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
![]() |
|
Created this page in 0.42 seconds |