VIM + ctags configuration in Ubuntu

Source: Internet
Author: User
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.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.