Talk Vim together (16th back: ctags of Vim plug-in), vimctags
Hello, everyone. You are welcome to join in to hear the story of Zhang huiti: Vim. We introduced the ctags in the Vim plug-in last time.
In this case, let's continue with the plug-in. Or that sentence. Let's leave it for now. Let's talk Vim together!
We talked about how to install the Vim plug-in ctags to the system in the last time. The reader told me that this plug will not be used.
. We are worried about how to use the ctags plug-in.
The procedure for using ctags is as follows:
- 1. Generate the tags file:
As we mentioned in the previous article, ctags are mainly used to generate files with tags. Do you remember our metaphor? Tags text
It is like a map. The generated tags file is used to create a map. Run the command: ctags-R to generate the current directory.
The tags file of all files under (including subdirectories. The default generated tags file is tags (note that there is no suffix ).
We recommend that you modify the Vim configuration file so that Vim can automatically import the tags file at startup. How to modify Vim
The configuration file has been described in the previous step. For more information, see Step 4 in the previous step.
Use Vim to open the program file, place the cursor on a function, and press ctrl +] to quickly jump to the function.
In this way, we can quickly find the implementation of this function. I would like to explain here
The program file must be under the directory where the tags is generated. Otherwise, Vim will prompt that the tags information cannot be found.
Normally, we use Vim + ctags to read the source code of the program. ctags provides a powerful function.
You can quickly locate the function definition to save time for searching the function and improve the efficiency of reading the program source code.
For more information, see the Vim plug-in ctags. In later chapters, we will also talk about other Vim plug-ins.
. What plug-ins will be available in the future? In addition, the next loop is decomposed.