[Turn] about the use of vim,ctags

Source: Internet
Author: User
Tags parent directory

November 21, 2010, Sunday 09:50
Questions raised:
Under Windows There are sourceinsight can easily locate functions, variables, macro definitions, and so that developers to manage project code, improve development efficiency, then in Linux how to do similar operations.
Vim can use Ctags made tags file to browse program source files, to achieve sourceinsight similar functions.

How to use:
1, Generate tags file
In the root directory of the directory tree, use the command: Ctags-r or ctags--recurse
such as: Ctags-r src/*, will be in the current directory to generate tags file
2, edit vim configuration file. vimrc
Add two lines:
Set tags=tags;
Set Autochdir
Note that the semicolon in the first command is essential. This command let vim first in the current directory to look for tags file, if not found tags file, or did not find the corresponding target, to the parent directory to find, has been recursive upward. Because tags file records in the path is always relative to the tags file location, so you want to use the second settings to change the current directory of Vim.

Of course, if you want to use the absolute path directly, this is also possible:
Set Tags=/home/xxx/myproject/tags

3, vim file, with Ctrl] to carry out the jump, through the ctrl+t to jump back on it, very convenient.

Other tools:
These are not tested again.
Link:linux Programming Assistant Tool Vim+ctags+taglist+cppcomplete+cscope+global

Vim+ctags+taglist use of 1.fedora 7 has been installed Ctags, available command ctags-v view; into an original file, vi test.c, enter the command mode, enter the command ": Tlist", if the left and right two column columns display, Then the TagList is also installed on the 2. For taglist installation, it is a vim plug-in, can be downloaded in sourceforge, is a zip file, with the unzip command to unlock, the doc and plugin two folders, two of them are copied to/usr/ Share/vim/vim70 under Doc and plugin, the next job is to Ctags and taglist, modify plugin inside the Taglist.vim, in command line mode input command lookup ":/loaded_taglist" Once found, precede the line with the following line: Let tlist_ctags_cmd= "/usr/bin/ctags". 3. How to use: in/usr/include (often see inside the definition of the function) under the command: Ctags-r, found in there is a tags file. Tags can only be used under/usr/include, if you want to use in other paths, you need to modify Vim's configuration file/ETC/VIMRC, add: Set Tags=/usr/include/tags,ok 4.ctrl+] View definition Ctrl+o return 5.vim Settings Edit/ETC/VIMRC, add:                1 Set (soft) tab width to 4:                             set tabstop=4                       & nbsp;      Set softtabstop=4                2 Set the number of spaces indented to 4                           set shiftwidth=4                3 Set Auto indent: That is, the indentation value of each row is equal to the previous line; Use Noautoindent to cancel the setting:            Set Autoindent                4 Setting up the automatic indent mode using C + + language:                           set cindent                5 If you want to display the line number of the text on the left, you can use the following statement:                   & NBsP;      set number                6) Bracket matching                           Set Showmatch


http://blog.csdn.net/wooin/article/details/1858917
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.