# making vim autoclose {} tags adds a space

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!

• 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? Oct 1 '17 at 9:28

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.