Giter Club home page Giter Club logo

vim-tags's Introduction

vim-tags

Vim-Tags version 0.0.2

The Ctags generator for Vim

Copyright (c) 2012 Szymon Wrozynski

About

Ctags support is a great feature in Vim. One approach to make use of Ctags is the way of Tim Pope's plugins. For example in Rails projects, Ctags are generated automatically while Bundler is running and installing new gems.

Vim-Tags plugin treats Ctags like more tightly coupled within a concrete project. It creates '.tags' files directly in the root project directory. Also, it can perform tags creation upon each file saving through forking - available under Unix-like operating systems. This option, however, may require some tweaking under Windows.

Vim-Tags is under active development. Currently, besides its main features, it provides some support for Ruby/Rails projects (it can generate tags for gems listed in 'Gemfile.lock' file).

Installation

Place in ~/.vim/plugin/tags.vim or in case of Pathogen:

cd ~/.vim/bundle
git clone https://github.com/szw/vim-tags.git

Vim-Tags requires ctags utility. On Ubuntu you can install it with:

sudo apt-get install exuberant-ctags

Usage

The plugin has only one command and a few options described in the Configuration section:

:TagsGenerate

This command generates one or more tags files. By default, it generates only the "tags" file collecting tags from all files nad subdirectories of the current working directory - assuming it's the root of the project.

By default, you rarely will have to use this command, because once the "tags" file is found in the root directory, the tags are generated on each file saving. So, in most cases, to enable Vim-Tags support just create empty "tags" file:

touch tags

and start Vim. On first file saving (any file is considered), the tags will be generated.

Additionally, you can exclude some directories from the main "tags" file, especially if they contains rarely changed and heavy content, i.e. third-party libraries. Those directories must be placed directly at the root.

To exclude them, make empty files named exactly after those directories with ".tags" suffixes: e.g. "vendor.tags" for the "vendor" directory and start (or restart) Vim. Beginning from the next Vim run, the plugin will be watching modification times of those directories and corresponding tags files and perform tags generation only if necessary.

The last but not least feature is the Ruby Bundler support. It's easy and straightforward. If your project root contains "Gemfile.lock" file, the plugin will be generating tags for all your Bundler gems referenced in the Gemfile. Here, "Gemfile.lock" modification time will be taken to find out whether the tags generation is required, just like in the custom directories case explained earlier. The plugin will create "Gemfile.lock.tags" file automatically

Configuration -------------

Vim-Tags assumes that you have 'ctags' utility available in your shell. However it is possible to change or improve shell commands used by the plugin, e.g. in case you have to point a proper binary with absolute path or tweak some options.

Vim-Tags can be configured by setting some global variables in your ".vimrc" file.

The available variables are:

  • vim_tags_auto_generate

    • Default: 1

    If enabled, Vim-Tags will generate tags on file saving

      let g:vim_tags_auto_generate = 1
    
  • vim_tags_project_tags_command

    • Default: "ctags -R {OPTIONS} {DIRECTORY} 2>/dev/null &"

    This command is used for main Ctags generation.

      let g:vim_tags_project_tags_command = "ctags -R {OPTIONS} {DIRECTORY} 2>/dev/null &"
    
  • vim_tags_gems_tags_command

    • Default: "ctags -R -f Gemfile.lock.tags bundle show --paths 2>/dev/null &"

    Command used for Gemfile tags generation.

      let g:vim_tags_gems_tags_command = "ctags -R -f Gemfile.lock.tags `bundle show --paths` 2>/dev/null &"
    

Author and License

Vim-Tags plugin was written by Szymon Wrozynski. It is licensed under the same terms as Vim itself. For more info see :help license.

vim-tags's People

Contributors

szw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

sirlsliang

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.