VIM + ctags configuration in Ubuntu
Ctags can create source tree indexes so that programmers can quickly locate functions, variables, macro definitions, and other locations to view the original shape during programming. The following describes how to download, install, and configure ctags in Ubuntu:
Download and install ctags, and enter the command on the terminal Sudo apt-Get install ctags
Build source index, for example, I often need to check the Linux kernel code, and the code is stored in the/home/hsf-951/ARM/linux-2.6.12 directory After the terminal enters the directory, enter the command ctags-R * and you will find an additional tags file, which is the index file.
Register the index file tags path with vim, and enter gedit/etc/Vim/vimrc on the terminal as the root user. Add a line at the end of the file to open (of course, the specific path is based on your own situation) Set tags =/home/h0000951/ARM/linux-2.6.12/tags
Then close the terminal and re-open it. You can use Vim to view the Linux function prototype anywhere.
------------------------------------ The simplest example Use VI to write a test. c file in any directory. The content is as follows: Int main (void) { Printf ("helloworld! "); Return 0; } After writing the script, input W in the last line mode and save it (do not exit VI). Press ESC to return to the command mode and place the cursor on printf. Press Ctrl +], and VI will automatically jump to the Linux system function printf (). Then we can view the prototype of printf (). After checking, press Ctrl + O to return to the original location. |