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-parenreadline option as it seems to hijack the closing characters. - If
BASH_AUTOPAIR_BACKSPACEis set, the plugin will disable thebind-tty-special-charsoption 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.shTo enable Backspace, add the line:
export BASH_AUTOPAIR_BACKSPACE=1Once installed, the "plugin" will automatically insert closing pairs whenever you type the opening part of any of the below parts:
""
''
()
[]
{}
Escaped characters won't be auto paired to let you compose literals with ease. Try typing:
sed "s/\"\'//g"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