Use Vim to replace Source Insight (ctags + taglist +) V Im Tags uses the example of CTAG Protocol If you do not study it, you can run the following command in the source code example:
Ctags-R *
In this case,Tags This region (available-F Select the file name). The file contains the tags information of all the source code cases, including all the sub-projects under it.Ctags It is already possible to provide a clear picture of the case and ignore cases that are irrelevant to the program. Of courseCtags There are still many excellent metric data available, pleaseMan Ctags . Please note that,Ctags The sequence is sorted by the sequence, so you do not have to sort the sequence by yourself. There is a good thing about sorting, that isV Im Binary Search will be used to search logs, which is faster than binary search.
General tag usage If tag files are generated in the previous exampleVim When you open a ticket, the ticket will be automatically merged. Tags This case does not need to be written separately. Otherwise: Set tags = Your. tags To specify the tags listener. Then it is generally used. V Im In other words, the game tag is moved to the identification word or function nameCTRL +] To return to the original location, pressCTRL + T . Please note that,V Im When an animation is triggered (Vim The project name of the notebook) Tags Will be automatically merged,$ Vimruntime/doc And$ Home/. Vim/doc Under Tags The token will also be automatically imported. In addition, all the text marked in the tags segment can be used to complete the entire text. Do not forget this useful function. Use tags freely in the directory tree
Edit the vim settings file (_ vimrc or. vimrc) and add two lines.
Set tags = tags;
Set Autochdir
Note that the semicolon in the First Command is essential. This command allows Vim to search for the tags file in the current directory first. If the tags file is not found or the corresponding target is not found, it will be searched in the parent directory, and it will go up recursively. Because the recorded path in the tags file is always relative to the path of the tags file, you need to use the second setting item to change the current directory of vim. After using these two techniques, you can freely browse the source program in the directory tree. Allows your vim to view the function list (taglist)
Many editing software in the graphic interface can list the functions in the current editing file, so that you can quickly jump to the editing page. Although Vim does not directly provide this function, it works perfectly with appropriate tools and settings! Install it first. Vim does not need to be installed. The ctags used in Ubuntu need to be installed by yourself. Do not use the old ctags. The new ctags is called exuberant ctags. , APT installation: APT-Get install Exuberant-ctags. Then follow the installation instructions on vim.org. Download taglist_45.zip and decompress it to The. Vim subdirectory in the home directory: ~ /. Vim $ unzip/home/fwolf/taglist_45.zip Archive: /Home/fwolf/taglist_45.zip Inflating: plugin/taglist. Vim Inflating: DOC/taglist.txtGo to the $ home/. Vim/doc directory and run "helptags" in vim. . "Command, note that the following points should not be pulled, this is to generate the index of the ctags help file, and then the help can be used normally. (In the original VI help, CTRL +] entered the link and CTRL + T returned) Now, start vim and use the tags function:
General Usage: When using vim, use the tlist command to switch the ON and off of the function list. Press ctrl and press W to switch between the normal editing area and the tags area. In the tags area, move the cursor to the variable and function name, and press enter to automatically locate the specified content in the normal editing area. Common settings for vimrc: "Do not automatically change the current Vim window size. Let Tlist_inc_winwidth = 0 "Place the method list to the right of the screen. Let Tlist_use_right_window = 1 "Automatically fold the list of methods for files not being edited, which saves some screen space. Let Tlist_file_fold_auto_close = 1 |