Get ctags in vim to go to definition, not declaration

前端 未结 10 2089
礼貌的吻别
礼貌的吻别 2020-12-07 15:25

I\'m having the problem that ctags in vim/gvim takes me to a forward declaration a lot of times instead of to the actual definition of the function.

Any way to get a

10条回答
  •  不思量自难忘°
    2020-12-07 16:23

    There are several ways to make Vim to jump to a tag directly, if there is only one tag match, otherwise present a list of tag matches.

    You can use the 'tjump' ex command. For example, the command ':tjump func1' will jump to the definition func1, if it is defined only once. If func1 is defined multiple times, a list of matching tags will be presented.

    You can position the cursor over the tag and press g Ctrl-].

    You can visually select a text and press g Ctrl-] to jump or list the matching tags.

    You can use the 'stjump' ex command. This will open the matching or selected tag from the tag list in a new window.

    You can press Ctrl-W g Ctrl-] to do a :stjump.

    Help: :tjump, g_Ctrl-], v_g_CTRL-], :stjump, Ctrl-W_g_Ctrl-]
    

提交回复
热议问题