How can I auto-lock brackets in vim?

I am starting to code a lot with vim, in particular C. Although I have added some tricks to my vimrc file to format code colors, line numbers, etc., I wonder if there is a way to do the following:

It -

int main() { 

becomes the following:

 int main() { } 

Does anyone have any ideas or suggestions? I will try to try, while it will save me from forgetting about another bracket again!

+4
source share
1 answer

There are tons of plugins for this smart: autoclose , closepairs , others ... I use delimitmate .

But you can also go the lo-tech way:

 inoremap { {<cr>}<Co>O 
+4
source

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


All Articles