How to jump to the beginning of the current function body in Vim?

前端 未结 7 1556
抹茶落季
抹茶落季 2021-02-02 05:14

As title, if I\'m in the middle of function body and the function body is very long, how can I jump back to the beginning of the function body .

7条回答
  •  孤独总比滥情好
    2021-02-02 05:59

    C language [[

    If your C code is in the non-Egyptian style:

    [[
    

    [m only works if you have an enclosing {} around the function, e.g. class { method(){} } for Java / C++.

    And this is a good bet that works for both Egyptian and non-Egyptian braces:

    ?^[^ \t#]
    

    Examples:

    void egypt() {
    #define DONTCARE 1
        int indented code = 1;
    }
    
    void tpyge()
    {
    #define DONTCARE 1
        int indented code = 1
    } 
    

提交回复
热议问题