Selecting entire function definition in Vim

前端 未结 11 689
醉话见心
醉话见心 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:27

    You can use this shortcut to delete not only the function, also the lines between curly braces, i.e the code between if-else statements,while,for loops ,etc.

    Press Shitf + v [Will get you in visual Mode] at the curly brace start/end.

    Then Press ] + } i.e ] + Shitf ] - If you are in start brace.

    Then Press [ + { i.e [ + Shitf [ - If you are in end brace.

    Then DEL to delete the lines selected.

提交回复
热议问题