Question

I am using ctags -R * to generate tags.But its not generating the tags for .haml and .less files. Is there a separate option to generate tags for these files?

Was it helpful?

Solution

I don't think haml is supported in ctags by default. Here are the supported languages: http://ctags.sourceforge.net/languages.html. You could probably add support for it with a bit of googling.

OTHER TIPS

To add support for less, paste this in your ctags file:

--langdef=less
--langmap=less:.less
--regex-less=/^[ \t]*\.([A-Za-z0-9_-]+)/\1/c,class,classes/
--regex-less=/^[ \t]*#([A-Za-z0-9_-]+)/\1/i,id,ids/
--regex-less=/^[ \t]*(([A-Za-z0-9_-]+[ \t\n,]+)+)\{/\1/t,tag,tags/
--regex-less=/^[ \t]*@media\s+([A-Za-z0-9_-]+)/\1/m,media,medias/

The above expressions are ctrl-] friendly. If you're using scripts like kien/ctrlp.vim, use

--langdef=less
--langmap=less:.less
--regex-less=/^[ \t]*\.([A-Za-z0-9_-]+)/.\1/c,class,classes/
--regex-less=/^[ \t]*#([A-Za-z0-9_-]+)/#\1/i,id,ids/
--regex-less=/^[ \t]*(([A-Za-z0-9_-]+[ \t\n,]+)+)\{/\1/t,tag,tags/
--regex-less=/^[ \t]*@media\s+([A-Za-z0-9_-]+)/\1/m,media,medias/

it'll add . before classes and # before ids.

You can query the list of supported languages with

$ ctags --list-languages

There are some patches for Exuberant Ctags that add native support for more languages, but I haven't yet seen anything for haml or less. However, you can add support via regular expression definitions in your ~/.ctags; see the ctags help.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top