Selecting entire function definition in Vim

前端 未结 11 675
醉话见心
醉话见心 2020-12-07 14:14

I\'ve been trying Vim for any text editing work for almost a week now. I want to know the fastest way to select a C function definition.

For example, if I have a fun

11条回答
  •  离开以前
    2020-12-07 14:34

    Another way is to go to the line of the start of your function and hit: Vj% (or V%% if your style puts the opening brace on the same line). This puts you into Visual-Line mode and the percent takes you to the matching closing brace. In the second style, the first % takes you to the opening brace on the line that you selected and the second to its matching closing brace.

    Also works for parentheses, brackets, C-style multi-line comments and preprocessor directives.

    See the manual for more info.

提交回复
热议问题