How to configure ctags in vim in Ubuntu

Source: Internet
Author: User
In vim in Ubuntu, ctags can be configured to index the source code tree, allowing programmers to quickly locate functions and variables during programming, macro definition and other locations to view the prototype below is the download and installation of ctags in vim in Ubuntu and the configuration process: Download and install ctags on the terminal and enter the following command: in vim of ap Ubuntu, the ctags configuration method ctags can create an index of the source code tree, allowing programmers to quickly locate functions, variables, macro definitions, and other locations during programming to view the prototype. run the following command on the terminal to download and install ctags in vim in Ubuntu: apt-get install ctags build Source Code Index for example I often need to check the Linux kernel code, and the code in the/root/linux-2.6.14 directory, then after the terminal enters this directory, enter the ctags-R command and you will find an additional tags file, which is the index file. register the index file tags path with vim. enter vim/etc/vim/vimrc on the terminal as the root user, and add a line at the end of the opened file (the specific path depends on your own situation): set tags =/root/linux-2.6.12/tags then close the terminal and re-open it, you can use vim to view the function prototype for Linux anywhere. move the cursor over a function and press Ctrl +]. vim will automatically jump to the function. then we can view the function prototype and check it, press Ctrl + o or Ctrl + T to return to the original place. after modifying the program, for example, adding a function definition or deleting a variable definition, the tags file cannot be automatically rebuilt. you must manually run the command: ctags-R to update the tags file, however, it is gratifying that vim does not need to be restarted, and the program being compiled does not need to be exited. it can be used correctly immediately.

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.