Ctags with vim

Source: Internet
Author: User

Usage: $ ctags [-R] inc_dir/*. h export de_dir/*. HPP src_dir/*. c
Example: $ ctags-r 'Find.-Name "*. c" ''find.-Name "*. H "'
Su; CD/usr/include; ctags -- c-types = + P + X-sort-R
Generate a complete, huge, and ordered tags

Users ~ /. Add set tags =./tags, tags,/usr/include/tags to vimrc.
[NOTE 1] The + P switch will jump to the place where the variable is declared instead of its implementation, so the default value is used,
Don't -- c-types option, or as long as + x (recommended), it doesn't matter.
Also,/usr/include is not a symbolic link of/usr/src/Linux/include,
Therefore, if you are looking at the definitions of some variables in the kernel, you should use ctagsctags to browse the code on/usr/src/Linux (some commands may be inaccurate)
: Set tags =/DIR/tags to set the required tags file,
Multiple: Set tags =/dir1/tags,/dir2/tags
: Tag XXX is transferred to the definition that meets the search code, abbreviated as: Ta xxx
: Tag/^ XXX to the tag starting with xxx
Other find tags: stag/ptag/TS/TJ/pts/ptj/<Pat>
: Tag/xxx list all tags containing xxx
: The tag is forwarded to the previous viewed tag.
VI-t xxx is directly located at the definition of XXX
: Tn/: TP to the next/previous tag code, you can use: 5tn form
: TR/: TL to the first/end tag code
<C-]>, <c-left-click> go to the function where the cursor is located or the definition of the variable G + left-click (GUI) [Note 2]
<C-T>, <c-right-click> back to the code before jump (applicable to any jump) g + right-click (GUI)
: Tags: list the content of the current tag Stack
: Ts XXX lists all matching codes and their files, and provides the option to browse
: Sts xxx lists matching items and provides options to open files in a new window.
: Tj xxx is similar to: ts XXX. It is directly transferred to the code when only one matching exists.
G] is the same as: ts XXX (tag is the identifier under the cursor)
<C-W> G] is equivalent to: STS xxx
G <c-]> is equivalent to tj xxx.
: PT? XXX provides the preceding command (? Is J, S) preview function, exit window: Q!
: T ?! Xxx changes to the current file are discarded and transferred to the target file.
<C-W>} the tag under the current cursor is displayed in the preview window.
: PTL/PTF/PTN/PTP is similar to Tl, TF, TN, TP
: CHE: Check the unfound header file (checkpath)
Makeprg: Set makeprg = gcc/Yourfile. C for online compilation settings
: Make Online Compilation
: CN/: CN move to the compiled/previous error
: Stag XXX: Find the declaration of XXX and open it in a new window.
: Ta {ident} jump to the identifier Definition
GD jumps to the definition of a local identifier. [Note 2] Ctrl-] It happens to be a telnet terminal character. If you remotely edit a file, you may encounter some problems,
See online help: H ^]. Most Telnet requests can be opened using the telnet-e hostname command.
Disable the escape character, or use Telnet-e escape hostname to specify another escape character.
To replace ^]. For man telnet, see-e's help.
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.