Selecting entire function definition in Vim

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

    If you are willing to install plugins vim-textobj-function will give you vif for Visual select Inside Function and vaf for Visual select A Function.

    daf will delete the function, both the line with the signature and the function body ({})

    The text object defined by this plugin are more specific and they don't rely on the function body being a contiguous block of text or { being placed at the first character on the line.

    The drawback is that you depend on an external plugin.

提交回复
热议问题