Giter Site home page Giter Site logo

kenyth / indexer.tar.gz Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vim-scripts/indexer.tar.gz

0.0 1.0 0.0 204 KB

indexing all files in project with ctags (can work as add-on for project.tar.gz)

Home Page: http://www.vim.org/scripts/script.php?script_id=3221

indexer.tar.gz's Introduction

This is a mirror of http://www.vim.org/scripts/script.php?script_id=3221

If you are russian, you might want to read article in russian about this plugin (NOTE: now this artice is deprecated a bit: there's nothing about "vimprj" plugin in it. I'll update it when i have some time): http://goo.gl/7t8WE
-----------------------------------

This plugin can work in two ways:
1) independently
2) as add-on for project.tar.gz (vimscript #69)

In both ways, it provides painless automatic tags generation for whole project(s) and keeps tags up-to-date.

IMPORTANT: you need patched version of ctags (5.8.1) to make this plugin work correctly with C/C++ files, because of bug in ctags 5.8. You can read detailed info about this bug and download patched version here: http://dfrank.ru/ctags581/en.html

This plugin can be very useful when it's used together with plugins omnicppcomplete (for c, c++ development), code_complete.vim and other plugins that use tags.  You also will be able to jump from function call to its definition just by pressing Ctrl-] or g]

As i said, Indexer can work as add-on for project.tar.gz plugin ( vimscript #69 ). Indexer reads project file, parses it and builds tags for all files in project. But it also works fine without project.tar.gz.

Actually, if you use project.tar.gz plugin and your projects file is default (~/.vimprojects), then setting Indexer up is very easily: you can just install this plugin, start Vim and open any file from your project. Indexer will detect that opened file is a file from project and automatically start ctags for each file in this project.  It also set &path and &tags options for Vim.

If you use project.tar.gz, but you have another projects file, you should set option g:indexer_projectsSettingsFilename in your vimrc.

If you don't use project.tar.gz then you can use ".indexer_files" to define projects and files to index.  Default location of this file is "~/.indexer_files". You can change it by modifying variable g:indexer_indexerListFilename

Syntax of this file is simple, probably the best way to explain it is to show an example:

NOTE! Since Indexer 4.10 syntax of .indexer_files is changed a bit, to make ctags work much more effectively.  However, old syntax will work too, for backward compatibility.  If you used Indexer before with .indexer_files, please read this:
:help indexer-syn-change-4.10

--------------------- example ~/.indexer_files -----------------------
   [CoolProject]

   /home/user/cool_project

   [AnotherProject]
   option:ctags_params = "--languages=c++"

   /home/user/another_project/src
   /home/user/another_project/lib
-------------------------------------------------------------------------------
I hope all is obvious:
There's two projects: CoolProject and AnotherProject.
CoolProject just contains ALL files from "/home/user/myproject".
AnotherProject is configured more complicated.
It specifies additional parameter for ctags: "--languages=c++".
It is needed to make ctags ignore all files except c++ sources.
I would recommend you to read and understand ctags help, to be able to write perfect configuration for your projects.
You can read it here: http://ctags.sourceforge.net/ctags.html
The options you need to know first is the following two:
   --languages=[+|-]<list>
   --langmap=<map>[,<map[...]>]


If you have many projects and you are lazy to put every project in
this file, you can put in your ~/.indexer_files something like this:

--------------------- example ~/.indexer_files -----------------------
[PROJECTS_PARENT]
option:ctags_params="--languages=c++,c,python,java"

~/workspace
-------------------------------------------------------------------------------

The keyword is PROJECTS_PARENT.
In this way, each directory in ~/workspace will be interpreted as separate
project, and you can open any file from any project in ~/workspace, and the 
whole proper project will be indexed.


Please note: suggested ctags options is tested with ctags 5.8. As far as i
know, option --languages is marked as deprecated in ctags 5.9, but i still did
not test it, because the latest version on http://ctags.sourceforge.net is
still 5.8. I hope i will have time for this soon.


Indexer 3.0 and later supports open several files from several projects. For example, a little story.

You have two projects: "project1" and "project2", and you use "~/.indexer_files".

1) you open file1 from project1. 
   Indexer generates tags for all files from project1 and set &tags:
   ~/.indexer_files_tags/project1
2) you open file2 from the same project1.
   Indexer just notes that file2 is file from project1. 
   &tags does not change.
3) you open file3 from project2.
   Indexer generates tags for all files from project2 and set &tags:
   ~/.indexer_files_tags/project2.
4) you switch to buffer with file1.
   Indexer does not generate any tags, it just changes &tags to
   ~/.indexer_files_tags/project1
5) you switch to buffer with file3.
   Indexer changes &tags back to ~/.indexer_files_tags/project2 .

So, you should not care about your projects. It just works. If you have some projects with subprojects, i would recommend you to use .vimprj directory with specific settings for your project, in which you can set any options such as &tags, &tabstop, etc. More detailed: read :help vimprj

Actually, Indexer sets &path for needed project when you swith to new buffer, not only &tags.

----

It is successfully tested on Vim 7.3, on the following systems:
*) Archlinux
*) Ubuntu 10.4
*) Windows XP
*) Mac OS X Lion

Please, if you have another system configuration and all works fine for you, 
please send to me your configuration, i'll update text on this page.

If you have any troubles using this plugin, feel free to email me.
You also can contact me in irc:
server: irc.freenode.net
channel: #vim
nick: dfrank

-------------------------

Development mercurial repository: http://hg.dfrank.ru/vim/bundle/indexer_development
Stable git repository: https://github.com/vim-scripts/indexer.tar.gz (Note that this repository is auto-generated by http://vim-scripts.org as a mirror of http://www.vim.org)



indexer.tar.gz's People

Contributors

dimonomid avatar

Watchers

 avatar

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.