Automatically insert a matching brace in Vim

前端 未结 18 2584
醉梦人生
醉梦人生 2020-12-13 05:23

I spend way too much time fumbling around because Vim doesn\'t handle closing braces like most IDEs do. Here\'s what I want to happen:

Type this:

         


        
18条回答
  •  悲&欢浪女
    2020-12-13 06:14

    In VimL, you can map the { to do exactly as you wish:

    inoremap { {}ko
    

    depending on your autoindent setup, you may want to add a after .

    For a more complete solution, I'd suggest you take a look at Luc Hermitte's vim plugins. They've never failed me so far.

提交回复
热议问题