Small and furry, well ... definitely furry. [source]

Friday, March 26, 2010

Using ctags with Clojure

ctags is wonderful resource, I use it a lot while navigating code in Vim.

Currently ctags does not have a built in support for Clojure, but the Lisp parser is good enough. You just need to tell ctags to treat .clj files as Lisp files. This is easily done by adding the following line to ~/.ctags


--langmap=Lisp:+.clj


To make sure it works, you can run ctags --list-maps and see that .clj is a suffix in the Lisp parser.

1 comment:

  1. Cool, I didn't know about ~/.ctags.

    I really wish ctags were better known by the Emacs-using Clojure community. I would guess that 90% just use Slime's M-., which is rather limited. First, it only works on Clojure code that is loaded into the currently running process. And I don't believe who-calls works in swank-clojure, whereas you get that functionality with tags.

    With tags you can use M-. on code that you may just be reading but not have loaded into a running program. This is really nice if a library has dependencies or needs to be special setup and you just want to explore it first.

    And of course ctags works with other languages that might be in your project, such as Javascript.

    ReplyDelete