Skip to content

kimballa/project-tags

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


mktags is a script that generates TAGS files for Maven-managed projects with
Eclipse .project/.classpath files.

Along with some vim script magic, you can make vim use the tags files for only
the current Eclipse project and its dependency jars.

To set up:

1) Make sure 'projroot' is in your $PATH.
2) Put the following in your ~/.vimrc: 


" Find the git root, if there is one, and strip any leading/trailing whitespace.
let curProjRoot = system("projroot")
let curProjRoot = substitute(curProjRoot, "^\\s\\+", "", "g")
let curProjRoot = substitute(curProjRoot, "[\\s]\\+$", "", "g")
let curProjRoot = substitute(curProjRoot, "\\n", "", "g")
let curProjRoot = substitute(curProjRoot, "\\r", "", "g")

let fullTagList = strlen(curProjRoot) ? system("cat " . curProjRoot . "/.taglist") :
    \ "~/src/git/tags\\ ~/src/tags"
" 'set tags' will tokenize the spaces properly only if we use 'set'.
" Simply doing 'let &tags=...' won't properly pick up multiple tags
" files.
execute "set tags=" . fullTagList


3) Run mktags.sh -d <project-dir-name>, or cd <project-dir-name> && mktags.sh

This works for projects that use Maven to control their artifacts, and have
Eclipse projects generated by 'mvn eclipse:eclipse'. I use this with eclim
(www.eclim.org) to use Eclipse-like features like code autocomplete and online
syntax checking, but with a vim frontend.

The script snippet for your ~/.vimrc will ensure that if your project is
controlled by Eclipse, it will recursively seek toward the root of your
project (the parent dir of .classpath) and look for the .taglist file present
there (generated by mktags.sh).

You can use the "gitroot" program instead of "projroot" to find a .taglist
file in the parent directory of .git/, the root of your git repository.



LINKING PROJECTS TOGETHER

If one of your Maven projects depends on another Maven project, you should
configure the dependency to publish a source jar when you 'mvn install'.  To
do this, add the following to your pom:

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>2.1.2</version>
        <executions>
          <execution>
            <id>attach-sources</id>
            <goals>
              <goal>jar-no-fork</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

Then run mvn:install again. There will be a a (project)-(ver)-sources.jar
installed in ~/.m2/repository/. A subsequent execution of mktags.sh will use
sources from this file.


About

Manage ctags files for Maven-controlled projects

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages