Automatically insert a matching brace in Vim

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

    Just a note to @Bob.

    Karl Guertin's AutoClose has a function named ``double brace'', that is, you can type curly brace twice, as below.

    int func_name(void) {{ ==> Type `{' twice here.
    

    would result in:

    int func_name(void) {
    | ==> Cursor here.
    }
    

    Then, you can type a single Tab, to get indented according to your `shiftwidth' setting, then type.

提交回复
热议问题