gen_tags.vim


Ⅰ. 插件描述

Async plugin for vim and neovim to ease the use of ctags/gtags

Ⅱ. 基本信息

创建日期:  2013-11-20
使用用户:  52
Github星:  261
插件作者:  Jia Sui

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'jsfaint/gen-tags-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'jsfaint/gen-tags-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'jsfaint/gen-tags-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/jsfaint/gen_tags.vim

Ⅳ. 文档说明

# gen_tags.vim

Join the chat at https://gitter.im/gen_tags-vim/Lobby

Async plugin for Vim/NeoVim to ease the use of ctags/gtags.

It is used for generate and maintain tags for you with multiple platform support, tested on Windows/Linux/macOS.

gen_tags.vim will detect SCM(git, hg, svn) root and use it as the project root path. But you can also create a folder named as .root to specify a directory as the project root path.

Generate/Update ctags and gtags will run in background.

Difference between ctags and gtags

GNU global(aka gtags) is more powerful than ctags, which support definition, reference, calling, called, include, string and etc, but ctags only support definition.

As we can use GNU global why did I still support ctags in this plugin?

That's because GNU global only support 6 languages (C, C++, Yacc, Java, PHP4 and assembly) natively.

ctags can support more languages(41 showed on the website).

Actually global can support more languages with Pygments plugin parser, for more details please refer PLUGIN_HOWTO.pygments in global document.

Installation

Add call dein#add('jsfaint/gen_tags.vim') to your vimrc

Then launch vim/nvim and run :call dein#install()

Add Plug 'jsfaint/gen_tags.vim' to your vimrc

 Then launch vim/nvim and run :PlugInstall

  • Traditional method

Unzip the zip file under your .vim(*unix) or vimfiles(windows) directory.

Ctags support

Commands For Ctags

  • :GenCtags

    Generate ctags database

  • :EditExt

    Edit an extend configuration file for this project, use for add third-party library ctags database

    The extend database will be generate automatically.

    e.g.: For libpcap under e:\src\libpcap-1.3.0 add the following content to ext.conf

    e:/src/libpcap-1.3.0
  • :ClearCtags

    :ClearCtags      Remove tags files.
    :ClearCtags!     Remove all files, include the db dir

Gtags support

GTAGS support the third-party library by set an environment variable GTAGSLIBPATH

But you can take a more straightforward way to do the same thing, by create a symbol link of the library

  • Linux/macOS

    ln -s /usr/include/ .
  • Windows

    mklink /J include C:\TDM-GCC-32\include

Commands For Gtags

  • :GenGTAGS

    Generate GTAGS

  • :ClearGTAGS

    :ClearGTAGS     Remove GTAGS files
    :ClearGTAGS!    Remove all files, include the db dir

Key Mapping

ctrl+] is the default mapping support by Vim for definition

The following mapping is set for gtags when g:gen_tags#gtags_default_map is 1,
which uses the cscope interface .

Ctrl+\ c    Find functions calling this function
Ctrl+\ d    Find functions called by this function
Ctrl+\ e    Find this egrep pattern
Ctrl+\ f    Find this file
Ctrl+\ g    Find this definition
Ctrl+\ i    Find files #including this file
Ctrl+\ s    Find this C symbol
Ctrl+\ t    Find this text string

Detail Usage

For more details about the usage, please refer to the help document in vim by :help gen_tags.vim


Thanks for reading :)

If you like this plugin, please star it on github!

And one more thing, bug reports and pull-requests are greatly appreciated :)

添加新评论