Skip to main content
48 votes
Accepted

What's the difference between .bashrc and .inputrc

Settings that are in the .inputrc file affect all programs that use the GNU readline library, not just bash. Think of the .inputrc file as being a configuration file for GNU Readline similar to how ....
aliceinpalth's user avatar
  • 1,683
10 votes
Accepted

.inputrc vs .bashrc settings

From the bash manual: history-size (unset) Set the maximum number of history entries saved in the history list. If set to zero, any existing history entries are deleted ...
Kusalananda's user avatar
  • 356k
9 votes
Accepted

What Popular Programs Use GNU Readline?

This isn’t an exhaustive list, and I haven’t tried to determine popularity: Abiword, Amanda, Atari800, Bacula, Bareos, GNU bc, BlueZ, Cdecl, ConnMan, Freeciv, FreeRADIUS, GNU ftp, NetKit ftp, FVWM, ...
Stephen Kitt's user avatar
8 votes

Complete list of options for .inputrc / readline

You may want to check the bind Bash builtin command. Use help bind to see the different options. In particular, you could check the output of bind -l : List names of functions. bind -p : List ...
mivk's user avatar
  • 3,926
8 votes
Accepted

How to map alt backspace to some command in .inputrc?

For keys that normally send a single character, Alt+key normally sends the escape character followed by this character. In particular, Alt+Backspace sends \e\177 where \e is the escape character (...
Gilles 'SO- stop being evil''s user avatar
7 votes

Briefly jump to matching parentheses in Bash

The question https://stackoverflow.com/questions/47358440/blink-matching-paren-not-working-in-readline-prompt lists as part of the question the readline setting set blink-matching-paren on which I ...
myc3lium's user avatar
5 votes
Accepted

How do I tell readline to use an updated .inputrc?

You can use readline's re-read-init-file command, which is typically accessed theough C-x C-r (that's a Control-X, followed by a separate Control-R), if you use the "emacs" keybindings, which are the ...
filbranden's user avatar
  • 22.6k
5 votes
Accepted

Use environment variable in .inputrc keybinding

User meuh's tip to use shell-expand-line led me to this solution which puts the environment variable's value on the command line: $if mode=vi # Keymaps when we are in insert mode set keymap vi-...
Matthias Braun's user avatar
4 votes

unbind default key from inputrc

Binding to the nop will suppress the key action, but won't help in case you want to free up the key to be a prefix. Suppose you want to dedicate "M-c" as a prefix to a set of related macros, for ...
kkm mistrusts SE's user avatar
4 votes
Accepted

Bash's "set -o vi" vs readline's own options?

The two are identical. Doing set -o vi in an interactive bash shell calls the set builtin. The C code for the set builtin calls rl_variable_bind("editing-mode", option_name) (where option_name will ...
Kusalananda's user avatar
  • 356k
4 votes
Accepted

inputrc not working in ubuntu 18 as it used to in 16 and below

My guess is that the key bindings need a backslash "\". But I can't tell if that's all you need. I'm on Debian. "\e[A": history-search-backward "\e[B": history-search-forward "\e[C": forward-char "\e[...
Freddy's user avatar
  • 26.3k
4 votes

Can I make the clear command behave like Ctrl-L in Bash?

clear is a terminal command, excerpt of man clear: DESCRIPTION clear clears your screen if this is possible, including its scrollback buffer (if the extended “E3” capability is defined). clear ...
schrodingerscatcuriosity's user avatar
3 votes
Accepted

How do I remap Control-w in Bash?

The readline library (which is what inputrc configures) sets up bindings corresponding to the bindings of the terminal driver for cooked input. These are commonly known as stty keys because they can ...
Gilles 'SO- stop being evil''s user avatar
3 votes

Where is actually documented, that "\e" stands for the Alt key in .inputrc

You should find that \e is the escape character (meaning there's only one of them, character code 27, often written ESC) rather than an escape character (meaning one of several). I think in this ...
Chris Davies's user avatar
3 votes

Call functions from bashrc in inputrc

The form key: function only accepts readline built-in functions. As you found out, to enter text you need what it called a macro which has to be in quotes: key: "my macro\r". I don't see why you need ...
meuh's user avatar
  • 54.7k
3 votes
Accepted

Readline keymapping C-/ not working

The readline library follows the model of a physical terminal that could only transmit ASCII control characters and ANSI escape sequences. C-/ is not an ASCII control character; the ASCII control ...
Johan Myréen's user avatar
3 votes
Accepted

How do you set the colour of the bash tab completion when `colored-completion-prefix` is turned on?

$LS_COLORS is usually defined in ~/.bashrc using the dircolors command and a dir_colors file. I could not find any information on what entry is used by the colored-completion-prefix readline setting ...
paradroid's user avatar
  • 1,265
3 votes

Map Alt-c to Ctrl-u

You should use bind to bind a key to a readline function. bind -p lists all the current bindings, and should include: "\C-u": unix-line-discard so if you want to call that same function, ...
meuh's user avatar
  • 54.7k
2 votes

Execute a readline function without keybinding?

One case where it would make a lot of sense is to "overload" default keystrokes when the line is empty, since many bindings are otherwise meaningless in that case, so lots of the most ...
mwy's user avatar
  • 41
2 votes

Bind C-i and TAB keys to different commands in terminal applications via .inputrc

To add to Gilles's excellent answer, in the urxvt terminal emulator the key map can be configured through .Xresources as well: For instance, I added the following line to that file in order to ...
balu's user avatar
  • 290
2 votes

unbind default key from inputrc

I had to unbind using the following. The elusive important piece for me was adding the surrounding single quotes. FWIW, numerous variations work when running the command directly in the shell. But ...
OldBuildingAndLoan's user avatar
2 votes
Accepted

Why is my readline / .inputrc configuration being ignored?

TL;DR: Put comments on separate lines to configuration. A comment at the end of a line causes readline to silently ignore the whole line if the line would otherwise be valid. The manual does say: ...
Tom Hale's user avatar
  • 33.3k
2 votes

Use environment variable in .inputrc keybinding

Inserting the literal string $USER rather than the expanded value of the USER variable may not make a big difference, as the variable is likely defined with the proper value (assuming a Linux system) ...
Kusalananda's user avatar
  • 356k
2 votes
Accepted

Non recursive .inputrc macros

Assuming you haven't change the default binding for C-v as quoted-insert, you can prefix each " with that input quoting character: "\"": "\C-v\"\C-v\"\C-b"
meuh's user avatar
  • 54.7k
2 votes
Accepted

Use bash builtin `bind` command when starting chroot

Just a guess: You are trying to run a Bash built-in command in a chroot like this: chroot <PATH> bind -f <PATH_IN_CHROOT>/.inputrc && <PROGRAM_TO_RUN> But your chroot doesn'...
WGRM's user avatar
  • 828
2 votes
Accepted

Map Alt-c to Ctrl-u

Ctrl+u invokes the unix-line-discard widget in both vi command and insert modes: bash-5.2$ set -o vi bash-5.2$ bind -pm vi-command | grep -iw c-u "\C-u": unix-line-discard bash-5.2$ bind -pm ...
Stéphane Chazelas's user avatar
1 vote

Complete list of options for .inputrc / readline

not certain it's complete, but the Archlinux page for readline(3) provides a fairly comprehensive list of options. In addition to that there's the The GNU Readline Library documentation page which has ...
Nick J's user avatar
  • 111

Only top scored, non community-wiki answers of a minimum length are eligible