Any program or trick to find the definition of a variable?

前端 未结 8 1096
梦谈多话
梦谈多话 2021-01-02 09:01

Many times when I am watching others code I just want to find where and how a variable is defined. Normally what I do now is look for the type of the variable until I find t

8条回答
  •  不知归路
    2021-01-02 09:30

    In VIM you can use gd to see local variable declarations or gD to see global variable declarations, if they're defined in the current file. Reference Go_to_definition_using_g

    You can also use [i to see the definition without jumping to it, or [I to see all occurrences of the variable in all the included files as well, which will naturally show the definition as well.

提交回复
热议问题