A dead-simple Vim plugin to automatically insert the closing bracket/brace/parenthesis based on Vim Tip #630. Requires Vim 7.0 or higher.
This plugin was written because the other solutions interfered with SCIM and were more complex than I needed.
Place the contents of this repo in your Vim runtime folder (~/.vim
on
*nix systems or %USERPROFILE%\vimfiles
on Windows) or use your
favorite Vim plugin manager.
- Vundle:
tpenguinltg/vim-closing-brackets
- vim-addon-manager (VAM):
Closing_Brackets
The following are insert-mode mappings provided by this plugin. (
may
be replaced with [
or {
. The cursor position is denoted by |
.
Start | Input | Result |
---|---|---|
( |
(|) |
|
() |
(|) |
|
(<BS> |
||
<C-v>( |
(| |
|
(<Del> |
(| |
|
|) |
) |
)| |
)| |
) |
))| |
<C-v>) |
)| |
There is additionally an extra mapping for {<CR>
:
{
|
}
The opened line will be indented according to your settings.
This plugin does not attempt to autoinsert quotes or do any smart deletion of pairs.
As a collection of commands based on content from the Vim Tips wiki, this plugin is licensed under the Creative Commons Attribution-Share Alike License 3.0 (Unported) (CC-BY-SA).
The tip page has a list of plugins that offer more advanced functionality.