vim-autoclose

Inserts matching bracket, paren, brace or quote

This is a mirror of http://www.vim.org/scripts/script.php?script_id=1849

There are very simple ways to insert a closing brace by setting up a few mappings. The problem with all these approaches is that they break undo, history or both. This script is my sixth attempt at correcting this problem and the first one that has worked in all scenarios.

Using this script, typing ( will result in (|), where | is the cursor position and the double backticks are just marking input. Typing a ) will move the cursor outside the parens. This moving outside works even in nested scenarios. Typing if(my_array['key results in if(my_array[‘key|’]) and ) gets you if(my_array[‘key’])|.

The paired characters are: [, (, {, “, ‘

Note: in Vim files (including .vimrc), you may not want pairing of ” because it is the comment character. If you set a value for g:autoclose_vim_commentmode, the “ character will not be paired if Vim considers the current buffer to be a Vim file.

let g:autoclose_vim_commentmode = 1

If you like this script, you should also check out surround.vim

Related Repositories

vim-autoclose

vim-autoclose

This plugin for Vim enable an auto-close chars feature for you. For instance if you type an '(', ``autoclose`` will automatically insert a ')' and put the cursor between than. ...

vim-autoclose

vim-autoclose

Inserts matching bracket, paren, brace or quote ...

vim-tubaina

vim-tubaina

A syntax highlight and autoclose for tubaina markup language. ...

vim-autoclose

vim-autoclose

Inserts matching bracket, paren, brace or quote ...

vim-autoclose

vim-autoclose

This plugin for Vim enable an auto-close chars feature for you. For instance if you type an '(', ``autoclose`` will automatically insert a ')' and put the cursor between than. ...


Top Contributors

seletskiy tangledhelix blueyed Lokaltog andrewle rdpate

Releases

-   1.2 zip tar
-   1.1.2 zip tar
-   1.0.1 zip tar