Skip to content

Instantly share code, notes, and snippets.

@wereHamster
Forked from mads-hartmann/Coffeescript ctags
Created October 19, 2011 18:25
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save wereHamster/1299204 to your computer and use it in GitHub Desktop.
Save wereHamster/1299204 to your computer and use it in GitHub Desktop.
ctags definitions for Coffeescript. Very basic for now. "> ctags -e -R source_folder" and then M-. to jump to the definition of any function or variable (if you're using emacs)
--langdef=coffee
--langmap=coffee:.coffee
# Detects classes, static/class methods, plain functions and variables.
--regex-coffee=/^class ([A-Za-z.]+)( extends [A-Za-z.]+)?$/\1/c,class/
--regex-coffee=/^[ \t]*@?([A-Za-z.]+):.*[-=]>.*$/\1/f,function/
--regex-coffee=/^[ \t]*([A-Za-z.]+)[ \t]+=.*[-=]>.*$/\1/f,function/
--regex-coffee=/^[ \t]*([A-Za-z.]+)[ \t]+=[^->\n]*$/\1/v,variable/
@bogdan
Copy link

bogdan commented Dec 13, 2011

Thanks a lot.

A needed wrap regexp with "" before I make it work

@rosenfeld
Copy link

You can also declare a class like this:

(export ? window).MyClass = class MyClass
constructor: ...

I mean, it doesn't need to start with "class":

https://gist.github.com/2405554

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment