Skip to content

Instantly share code, notes, and snippets.

@mads-hartmann
Created April 7, 2011 07:44
Show Gist options
  • Star 26 You must be signed in to star a gist
  • Fork 9 You must be signed in to fork a gist
  • Save mads-hartmann/907245 to your computer and use it in GitHub Desktop.
Save mads-hartmann/907245 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
--regex-coffee=/^[ \t]*([A-Za-z.]+)[ \t]+=.*->.*$/\1/f,function/
--regex-coffee=/^[ \t]*([A-Za-z.]+)[ \t]+=[^->\n]*$/\1/v,variable/
@dreki
Copy link

dreki commented Oct 27, 2014

👍 @benjie

@coderofsalvation
Copy link

I've added these 2 lines to ~/.ctags (after the lines which benjies pasted above)

--regex-coffee=/[ \t](.*\.)?([A-Za-z_0-9]+[ \t]=.*\))/\2/f/ 
--regex-coffee=/^([A-Za-z_.0-9]+[ \t]=.*\))/\1/f/

That allows completion out of the box in vim without snipMate:

in insertmode, after typing few characters, ctrl-x ctrl-] will popup any matching function with arguments

@sysmon
Copy link

sysmon commented Aug 19, 2015

Very important to include

'(tags-case-fold-search nil)

This will make the tag search case sensitive, and that makes quite a bit of difference to navigation(reduces extraneous matches). Also, make sure to --exclude=anything_you_don't_care_about.

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