5

Automatically create matching braces in vim

view full story
linux-howto

http://unix.stackexchange.com – How do I automatically create matching braces in vim? It should work as follows: If I input an open brace the closing one should appear automatically and the cursor should be placed in between. To jump out of the brace pair the combination Ctrl-j is used. There are plenty of plugins providing automatic brace insertion. But they either use a different key combination than Ctrl-j to jump out of the brace pair or interfere with the UltiSnips key bindings. The following works as expected :inoremap ( ()<Esc>:let leavechar=")"<CR>i :imap <C-j> <Esc>:exec "normal f" . l (HowTos)