Vim Balanced Braces
This week I’ve published a Vim plugin for balancing inserted parentheses and brackets. Check the documentation for detailed getting started and usage instructions, the source code is available on GitHub. What follows is the TLDR for installation and usage…
Clone
mkdir -vp ~/git/hub/vim-utilities
cd ~/git/hub/vim-utilities
git clone git@github.com:vim-utilities/balanced-braces.git
Install
cd ~/git/hub/vim-utilities/balanced-braces
make install
Usage
While in Insert mode open/close curly-braces, parentheses, and square-brackets will have the following behavior:
-
{
Open curly-brace; automatically insert a closing curly-brace, and move the cursor left by one column -
}
Close curly-brace; optionally move the cursor right by one column, if currently on a closing curly-brace, or insert closing curly-brace -
(
Open parenthesis; automatically insert a closing parenthesis, and move the cursor left by one column -
)
Close parenthesis; optionally move the cursor right by one column, if currently on a closing parenthesis, or insert closing parenthesis -
[
Open square-bracket; automatically insert a closing square-bracket, and move the cursor left by one column -
]
Close square-bracket; optionally move the cursor right by one column, if currently on a closing square-bracket, or insert closing square-bracket