Question

I always type paired characters by pairs:

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

How do I map Vim immediately jump inside them when I type them during Insert Mode? I tried some googling but I can't seem to get the right search term.

Was it helpful?

Solution

Use the AutoClose plugin, which will insert the closing brace for you, leaving your cursor inside them. If you type the matching bracket quickly enough, it will move your cursor outside the pair.

OTHER TIPS

Without using any plugin, I found out I could use this:

inoremap '' ''<esc>i
inoremap "" ""<esc>i
inoremap () ()<esc>i
inoremap [] []<esc>i
inoremap {} {}<esc>i
inoremap <> <><esc>i
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top