A Bash plugin to automatically add closing pairs when typing in Bash's prompt.
This is useful for people who:
- are tired of typing the closing parts in commands like
command_here "$(other_command "${array[2]}")"
- may forget to add them
- The plugin will disable the
blink-matching-paren
readline option as it seems to hijack the closing characters. - If
BASH_AUTOPAIR_BACKSPACE
is set, the plugin will disable thebind-tty-special-chars
option as it prevents Backspace from being mapped.
Download and source the autopairs.sh
file from within your .bashrc
file. For
instance:
# .bashrc file
source ~/.config/bash/autopairs.sh
To enable Backspace
, add the line:
export BASH_AUTOPAIR_BACKSPACE=1
Once installed, the "plugin" will automatically insert closing pairs whenever you type the opening part of any of the below parts:
""
''
()
[]
{}
It will also delete pairs using C-h
and Baskspace
.
For instance, try typing and then deleting the following:
echo "$(echo "${var[@]}")"
Nikolaos Kakouros
GPLv3