kalmanb / sbt-ctags

Easily sources for you libraries enabling ctags for your sbt projects - for use with vim, emacs, sublime
Apache License 2.0
32 stars 3 forks source link

sbt-ctags

sbt-ctags allows you to easily manage Exuberant ctags for your project dependencies.

For use with vim, Emacs, Sublime Text 2 and others.

How it works - example

First update your dependencies:

> ctagsDownload

Then select the dependency you wish to import for example scala-library:

> ctagsAdd <tab>...
> ctagsAdd org.scala-lang:scala-library...
... or ...
> ctagsAdd org.scala-lang*
... or ...
> ctagsAdd *

This will extract the scala-library source into .lib-src/org.scala-lang.scala-library/ and run ctags over the whole project including the imported sources. Both Java and Scala libs can be added.

Now you can use ctags to navigate the scala-library source.

Make sure to add the following to your .gitignore

.lib-src
tags
ctags

You can remove a library for your tags file with:

> ctagsRemove <tab>...
> ctagsRemove org.scala-lang...
... or ...
> ctagsRemoveAll
... or ...
> ctagsRemove *

Installation

sbt installation

In one of these locations:

~/.sbt/plugins/plugin.sbt          # for sbt 0.12
~/.sbt/0.13/plugins/plugins.sbt    # for sbt 0.13
project/plugins.sbt                # only for your project

Add:

addSbtPlugin("com.kalmanb.sbt" % "sbt-ctags" % "0.3.0")

ctags installation

Install exuberant-ctags / ctags as per your OS.

Then you'll need to have ctags configured with scala definitions. An example is in conf/ctags.example copy/append it to ~/.ctags

If you run the following you should get a tags file created.

> cd <project>
> ctags

vim installation

Add the following to you ~/.vimrc

set tags=./tags,tags,../tags

emacs installation

Please contribute

sublime installation

See (https://github.com/SublimeText/CTags)

Tasks

> help ctagsDownload
> help ctagsAdd 
> help ctagsShowCurrent 
> help ctagsRemove
> help ctagsRemoveAll

Configuration

The following can be customised as needed:

For details on how to customise see: https://github.com/kalmanb/sbt-ctags/blob/master/conf/CustomCtagsPlugin.scala

Contributing / Compiling

Go for it!

> git clone https://github.com/kalmanb/sbt-ctags
> cd sbt-ctags
> sbt
> ^^0.12         # Change sbt version
> compile
> ^ clean        # run command 'clean' for sbt versions

Testing, use the playground

> cd sbt-ctags
> sbt
> ^^0.13
> publish-local
> exit
> cd playground
> sbt
> ctagsDownload

Tip: you can run ~/publish-local in the main dir and reload in the playground to update and test

Change Log

0.3.0

Features:

Bugfixes:

0.2.0

Features:

0.1.0

Initial version:

Road Map

See (https://github.com/kalmanb/sbt-ctags/issues)

License

Copyright (c) 2013 Kalman Bekesi

Published under the Apache License 2.0.