Use ctags in Linux to find the source code
1. ctags introduction:
"Oh, how can I view the implementation of XX functions for this many files !" I believe this is a complaint from many friends. Too many files make it impossible for us to locate a function implementation or macro-defined position. Obviously, it is very unfavorable for reading source code and personal learning. I hope that a software can input commands to precisely locate the function position. Yes, now there is such a tool: ctags, which needs to be used with the vim editor to make it easier to read the source code.
Read the source code in Linux-ctags + vim
What is ctags?
Ctags (Generate tag files for source code) is a tool that facilitates code reading in vim. Although ctags supports other editors, it only officially supports VIM. Ctags has been installed by default in VIM, which helps programmers easily browse the source code.
Ctags update address: Invalid.
What can ctags locate?
1) Use a macro defined by # define
2) enumerated variable value
3) Function Definition, prototype, and Declaration
4) namespace)
5) type definition (typedefs)
6) variables (including definitions and declarations)
7) class, struct, enum, and union)
8) class, structure, and union member variables or functions
2. Configure your environment to meet the requirements of ctags:
Run the yum command to install ctags:
Generate the tags file at the specified source code location, and add many parameters to improve the ctags function (to reflect its powerful functionality, I use it to generate the tags file of the linux source code ):
Then we can view the tags content and find that the original tags is the index of each element in the Linux kernel code, this is the reason why ctags can be quickly located in combination with vim (the query is based on the content of this file ):