1

I added a few lines to my .vimrc to autoclose tags like [], "", '', () these all work fine but somehow the autoclosing of {} adds a space in between them and I have no idea how this comes.

"auto complete brackets
33 inoremap { {}<Esc>i                                                                                                                          
34 inoremap [ []<Esc>i
35 inoremap ( ()<Esc>i
36 inoremap " ""<Esc>i
37 inoremap ' ''<Esc>i

Anyone has an idea? Ask if you think it's handy for me to post the rest of my .vimrc

Thanks!

1
  • I add this line for in my .vimrc inoremap \begin{document} \begin{document}<CR>\end{document}<Esc>O, but doesn't work. where is the error in this line?
    – alhelal
    Oct 1, 2017 at 9:28

1 Answer 1

1

It is possible that it comes from a trailing space at the end of the line 33 of your .vimrc. If a space is present after the last i character of your line, vim will interpret it literally and add it between your curly brackets.

Also you might be interested in the auto-pair plugin: it automatically insert matching characters and it also handle smarly the deletion of those characters.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.