Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Advanced readline settings for bash in Terminal UNIX
The bash shell used in the Terminal application can be tweaked a little for better interactive experience, by saving the following lines as .intputrc in your home directory:
set editing-mode vi
set show-all-if-ambiguous on
set completion-ignore-case on
set meta-flag on
set convert-meta off
set output-meta on
set bell-style visible
To be more precise, the .inputrc file changes some default settings for the readline library, which the bash shell uses when being used in interactive mode. For more options, see the readline man page. If you are more used to the emacs keybindings to edit the command line, omit the editing-mode line in the .inputrc file.

[robg adds: We've run a number of these before in separate hints, but there are a couple of new ones in this list. For a list of all the possible variables and an explanation of what each controls, type man bash, then press the forward-slash (/) to search, and type Readline Variables as the search term (capitalization counts).]
    •    
  • Currently 2.80 / 5
  You rated: 3 / 5 (5 votes cast)
 
[19,780 views]  

Advanced readline settings for bash in Terminal | 8 comments | Create New Account
Click here to return to the 'Advanced readline settings for bash in Terminal' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Advanced readline settings for bash in Terminal
Authored by: mjmsmith on Sep 04, '07 08:28:46AM

When readline is in vi mode, is there a way to get it to initially position the cursor at the end of the line?



[ Reply to This | # ]
Advanced readline settings for bash in Terminal
Authored by: dewab on Sep 04, '07 08:52:15AM

Looks like Control-E still works to get to the end of line.

Not sure why Esc-$ doesn't.

C'est la vie.



[ Reply to This | # ]
Advanced readline settings for bash in Terminal
Authored by: googoo on Sep 05, '07 11:13:53AM

I press <esc> A (upper case), and it takes me to the end of the line in insert mode.

-Mark



[ Reply to This | # ]
Advanced readline settings for bash in Terminal
Authored by: delight1 on Sep 04, '07 09:13:35AM

personally, i love "set completion-ignore-case on" so i can auto complete regardless of the case of the letters ^_^



[ Reply to This | # ]
Advanced readline settings for bash in Terminal
Authored by: La Shampoo on Sep 04, '07 03:45:59PM
Very important : add to the above (on a single line) :
export TERM=xterm
...in order to have on distant server a proper behavior "delete=backspace" in Nano/Pico text editor.

[ Reply to This | # ]
Advanced readline settings for bash in Terminal
Authored by: GaelicWizard on Sep 10, '07 08:31:54PM

Actually, you should NEVER do this.

You should never explicitly set the TERM variable. The TERM variable is set by your terminal emulator. You can pick which one Terminal.app reports from preferences, so don't put this line in any file. (Terminal.app offers six or so compatible choices, one of which is "xterm".)

JP

---
Pell



[ Reply to This | # ]
Other settings
Authored by: kholburn on Sep 05, '07 02:45:21AM
You can also put these in /etc/inputrc and they will be read by all accounts. Here are the settings I always add:

set bell-style none
#set prefer-visible-bell
set show-all-if-ambiguous on
control-p: history-search-backward
control-n: history-search-forward
"\e[3~": delete-char
The search history commands are extremely useful. I have been thinking of binding these to up arrow and down arrow.

You type some of a command and control-p takes you to the previous commands that statrted with that string.

Also get a good copy of bash_completion. It really makes a difference.

[ Reply to This | # ]
Other settings
Authored by: delight1 on Sep 05, '07 09:55:29AM

i tried using a system wide inputrc (without restarting the computer, but with new term sessions), and it didn't work T_T



[ Reply to This | # ]