bashrc - how to disable `alt-numkey` in bash shell
2014-07
I can bounce between apps in Chrome OS by pressing alt-N
, where N is the position of my app on the status bar. Useful!
But when I'm in the bash shell of my Nitrous.io box, pressing alt-N
to bounce to a different app gives bash a command: (arg: N)
.
What does the (arg: N)
command do in bash? A five minute search taught me plenty of hotkeys, but none with alt + number key.
And can I disable it?
You can remove them in an exactly same way as any other shortcut – with bind -r
for i in "-" {0..9}; do bind -r "\e$i"; done
If you hate loops, you may do it manually:
bind -r '\e-'
bind -r '\e0'
bind -r '\e1'
bind -r '\e2'
bind -r '\e3'
bind -r '\e4'
bind -r '\e5'
bind -r '\e6'
bind -r '\e7'
bind -r '\e8'
bind -r '\e9'
If you do not want this modifiers not only in Bash sessions but everywhere where GNU Readline provides them, add the following lines not in your .bashrc
but in your .inputrc
:
"\e-"
"\e0"
"\e1"
"\e2"
"\e3"
"\e4"
"\e5"
"\e6"
"\e7"
"\e8"
"\e9"
(Yes, just list them).
This question has been previously asked on stackoverflow:
It was the first result I got in google for "bash alt+number", hence I downvoted the question.
Bash readline
has a setting called blink-matching-paren
that is not working for me. If I type an open parenthesis on the command line, then some text, then a close parenthesis I don't get any blinking. Parentheses matching does work for me in vim
and emacs -nw
.
Here are the settings and versions, etc.:
$ bind -v | grep blink-matching-paren
set blink-matching-paren on
$ set -o | grep -E '\<(emacs|vi)\>'
emacs on
vi off
Various combinations of:
- Bash 4.0.33(1)-release
- Bash 4.1.9(2)-release
- Bash 3.2.51(24)-release
- mintty 0.9.2
- PuTTY 0.60 (with and without "Enable Blinking Text")
- xterm 243
- gnome-terminal 2.28.1
- TERM=xterm
- TERM=xterm-256color
What do I need to do to make parentheses matching work in Bash on the command line?
Try setting that in .inputrc
, like:
$ cat ~/.inputrc
set blink-matching-paren on
Somehow this setting does not work for me when set interactively, but works fine that way.