vim - How to use ctags to generate tags for glibc header files?
世界只因有你
世界只因有你 2017-05-16 16:42:46
0
2
681

what i want:

If you want to use the omnicompletion or omnicompletion function in vim to realize automatic completion of glibc functions, for example, enter pri in the C source file, and then press C-x C-o to pop up the list to complete printf, and so on.
The problem now is that I use ctags to process the standard C header files installed by glibc-headers-2.15-57.fc17.i686 and generate the tags_glibc file. But enter pri in the C source file, and then C-x C-o. In the pop-up menu, there are only the definition and prototype declaration of printf in stdio2.h, but not the printf declaration of stdio.h. What is strange is that I used vim to view the generated tags file, searched for printf, and found the following three entries:

printf	/usr/include/bits/stdio2.h	/^printf (__const char *__restrict __fmt, ...)$/;"	f
printf	/usr/include/bits/stdio2.h	108;"	d
printf	/usr/include/stdio.h	/^extern int printf (__const char *__restrict __format, ...);$/;"	p

The last one shows that ctags does generate the prototype declaration (type p) of printf in stdio.h, but why can’t I see the third one when I enter pri<C-x C-o> in insert mode? Where did I go wrong? ?
The same phenomenon also occurs in functions such as fprintf (this symbol is available in stdio.h and stdio2.h), memcpy (available in string.h and string3.h).

environment

My system is fedora17 (3.6.3-1.fc17.i686), ctags is the latest version, 5.8
The ctags command used is as follows:

ctags --langmap=c:.c.h --language-force=c -h .h --c-kinds=+pxl  --exclude='tags*' --exclude='*swp' --exclude='*~' --exclude='*[!ch]' -I _THROW -I __attribute__+ -I __wur -f tags_glibc -L glibc-headers-filelist.txt 

Among them, the generation of glibc-headers-filelist.txt is the following command:

rpm -ql glibc-headers |grep '\.h' >glibc-headers-filelist.txt

question

Dear vim experts, is there any way to better generate the tags file of the glibc header file

世界只因有你
世界只因有你

reply all(2)
滿天的星座

-e
Include extern tags. ctags will normally ignore extern declarations of functions or variables; that's handy when generating tags for your own programs. A tags file for the extern declarations in the system's standard header files can be a very handy resource, so this -e flag was created.

From http://elvis.the-little-red-haired-gi...

为情所困

When using tags files, you need to open vim in the directory where the tags are located.

When using different directories, you need to set the tags variable in vim, and the variable value is the tags file path. For example:

:set tags=....../tags_glibc
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!