Automatically insert a matching brace in Vim

前端 未结 18 2592
醉梦人生
醉梦人生 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:00

    A solution for braces, brackets and parenthesis with tab in between.

    " Automatically closing braces
    inoremap { {}ko
    inoremap [ []ko
    inoremap ( ()ko
    

    Result:

    function() {
      |
    }
    

提交回复
热议问题