Ubuntu vim+ ctags (includes system functions) + taglist Configuration

Source: Internet
Author: User

Reading large code, we often need to open a lot of code files, search for various definitions. Windows used to use the IDE's friends, when moving to Linux may feel very uncomfortable, can not find the right reading tools. In fact, the almighty vim can be achieved. The configuration of vim+ctags+taglist is described below.

Installing Ctags

Ubuntu source provides the installation of Ctags.

sudo apt-get install ctags
Installing TagList

Download:

http://vim.sourceforge.net/scripts/download_script.php?src_id=6416

Copy to Ubuntu and use the command to extract:

-d ~/.vim

You should get it after decompression. / d o c And /PLugin 。 Two directories then install into vim

cp ~/.vim/doc/taglist.txt /usr/share/vim/vim74/doc/cp ~/.vim/plugin/taglist.vim /usr/share/vim/vim74/plugin/

Then start vim, Command mode input

:helptags /usr/share/vim/vim74/doc/

After that, we can use

:help taglist.txt

command to view the TagList help documentation.

After that, modify i m r c File.
Add the following content:

"""""""""Ctags"""""""""set tags=tags"""""""""taglist"""""""""1let Tlist_Sort_Type="name"let Tlist_Exist_OnlyWindow =1‘/usr/bin/ctags‘11

Later, you only need to enter the source directory at the top level

Generate the tags file, and then use VIM to open your C file, you can use the shortcut key to jump.
Use Ctr and two times W to switch between the side window and the main window.

        Ctrl + ] //跳入定义        Ctrl + T //调回
Generate System tags for ctags

As you can see above, ctags only supports macros, variables and functions defined in the source file, but the basic functions and system functions we call are not able to jump.
Use the following command to generate the system header file tags

ctags -I __THROW --file-scope=yes --langmap=c:+.h --languages=c,c++ --links=yes --c-kinds=+p --fields=+S  -f ~/.vim/systags /usr/include /usr/local/include

Finally, set up your ~/.VIMRC and add a line:

set tags+=~/.vim/systags

You can enjoy the functions of system library function jump and so on.

Ubuntu vim+ ctags (includes system functions) + taglist configuration

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.