Vim imap problem for automatically closing quotes

I managed to get auto-closing brackets and parentheses on the right:

imap { {<return><return>}<Esc>kcc
imap ( ()<Esc>i

However, a quote cannot be written in brackets. If I write it like this:

imap " ""<Esc>i

he goes into an endless cycle. Why is this happening?

Then I wrote the quotes as follows:

imap " "<Esc>xPpi

This also has a problem. He eats the character to the left of the insert. I played with him, but could not figure out how to correctly display the map. Can anyone help?

+3
source share
1 answer

Try the following:

inoremap " ""<Esc>i

This way, it will not apply comparisons to the result of the match (no recursion)

+4
source

Source: https://habr.com/ru/post/1791140/


All Articles