atags.vim


Ⅰ. 插件描述

:collision: A plugin that simplifies tags generation on neovim

Ⅱ. 基本信息

创建日期:  2015-08-23
使用用户:  12
Github星:  41
插件作者:  Lorenzo Fontana

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

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

Ⅳ. 文档说明

atags.vim is a Neovim plugin that helps you creating and updating your tag files.

Installation

Using vim-plug

Plug 'fntlnz/atags.vim'

Customization

Customize the generation command

The generation command is a list of commands that will be executed to generate your tags.

This is the default generation command:

let g:atags_build_commands_list = [
    \"ctags -R -f tags.tmp",
    \"awk 'length($0) < 400' tags.tmp > tags",
    \"rm tags.tmp"
    \]

Use cases

Generate tags with <Leader>t

map <Leader>t :call atags#generate()<cr>

Generate tags everytime a file is being written.

autocmd BufWritePost * call atags#generate()

Generation examples

Generate tags using stags within a Docker container

let g:atags_build_commands_list = [
    \"docker run --rm -v $PWD:/project -w /project fntlnz/pfff:latest stags -lang php -o tags -vim ."
    \]
]

Generate tags only for files that are not in .gitignore

let g:atags_build_commands_list = [
    \ 'ag -g "" | ctags -L - --fields=+l -f tags.tmp',
    \ 'awk "length($0) < 400" tags.tmp > tags',
    \ 'rm tags.tmp'
    \ ]

Generate tags only for PHP files that are not in .gitignore

let g:atags_build_commands_list = [
    \ 'ag --php -g "" | ctags -L - --fields=+l -f tags.tmp',
    \ 'awk "length($0) < 400" tags.tmp > tags',
    \ 'rm tags.tmp'
    \ ]

Work in progress

  • [x] Support for different tag generators. At the moment this supports only ctags.
  • [ ] Use tpope/vim-dispatch to be compatible with vim that doesn't have jobstart
  • [x] Write the docs

添加新评论