gotags


Ⅰ. 插件描述

ctags-compatible tag generator for Go

Ⅱ. 基本信息

创建日期:  2012-03-23
使用用户:  40
Github星:  737
插件作者:  Joël Stemmer

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'jstemmer/gotags'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

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

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'jstemmer/gotags'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'jstemmer/gotags'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

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

Ⅳ. 文档说明

# gotags

gotags is a [ctags][]-compatible tag generator for [Go][].

Build Status
Report Card

Installation

[Go][] version 1.1 or higher is required. Install or update gotags using the
go get command:

go get -u github.com/jstemmer/gotags

Or using package manager brew on OS X

brew install gotags

Usage

gotags [options] file(s)

-L="": source file names are read from the specified file. If file is "-", input is read from standard in.
-R=false: recurse into directories in the file list.
-f="": write output to specified file. If file is "-", output is written to standard out.
-silent=false: do not produce any output on error.
-sort=true: sort tags.
-tag-relative=false: file paths should be relative to the directory containing the tag file.
-v=false: print version.

Vim [Tagbar][] configuration

Put the following configuration in your vimrc:

let g:tagbar_type_go = {
    \ 'ctagstype' : 'go',
    \ 'kinds'     : [
        \ 'p:package',
        \ 'i:imports:1',
        \ 'c:constants',
        \ 'v:variables',
        \ 't:types',
        \ 'n:interfaces',
        \ 'w:fields',
        \ 'e:embedded',
        \ 'm:methods',
        \ 'r:constructor',
        \ 'f:functions'
    \ ],
    \ 'sro' : '.',
    \ 'kind2scope' : {
        \ 't' : 'ctype',
        \ 'n' : 'ntype'
    \ },
    \ 'scope2kind' : {
        \ 'ctype' : 't',
        \ 'ntype' : 'n'
    \ },
    \ 'ctagsbin'  : 'gotags',
    \ 'ctagsargs' : '-sort -silent'
\ }

Vim+Tagbar Screenshot

vim Tagbar gotags

gotags with Emacs

Gotags doesn't have support for generating etags yet, but
gotags-el allows you to use
gotags directly in Emacs.

添加新评论