How do I get to declaring a C / C ++ function instead of defining it?

I know CTRL +] to go on to defining a function in different languages ​​in vim. How about going to the declaration in the C / C ++ header?

Since I have a lot of headers containing meaningful comments / explanations, I have often been to function declarations among a large code base. Are there any abbreviations for this?

+6
source share
3 answers

ctags does not add function prototypes by default. You must add an option.

- C ++ - types = + p

to support prototype functions. My ctags look like this:

ctags --C ++ - types = + p --fields = + iaS --extra = + q * .h * .c

When you are in a tag, you can use the following editor commands for the browser through the tags (the value of the same tag occurs several times, as a definition / declaration) -

tn (next tag)

tp (Previous tag)

+9
source

I am satisfied with cscope, which includes header files in the database.

Just put cscope_maps.vim in ~ / .vim / plugin / and then CTRL-] select all options if the cscope database is created.

To create a cscope database, simply enter

cscope -bR 
+1
source

Based on the habits of Bram 7 , without any plugin, you can do

1) Set the path to the headers (this is important for working with paragraph 2 below)

 :set path+=/path/to/headers 

2) Then run one of the following commands

[I Show the entire list in which the keyword under the cursor is in the header files or

[<Tab> will jump there, and you can return to your file using Ctrl + 6

0
source

All Articles