Last Updated: September 09, 2019
·
2.801K
· pepegar

Completion for parentheses, braces and brackets in Vim

Most of the times you are writing code you not only want to open a parenthesis but open and close it. This is the solution I have found for that in Vim.

Anyways, if you want to write a single opening parenthesis, just write '(' twice.

Simply put this in your .vimrc file:

inoremap { {}<left>
inoremap {{ {
inoremap {} {}
inoremap [ []<left>
inoremap [[ [
inoremap [] []
inoremap ( ()<left>
inoremap (( (
inoremap () ()
inoremap " ""<left>
inoremap "" ""
inoremap ' ''<left>
inoremap '' ''