3

For example I am editing index.html or index.php in VIM and I have the following code in there:

<div id="header">

// some code

</div>

When I move my cursor to the word header I want to jump to the position in my CSS-file where the tag (id/class) is defined. ctags doesnt work with this. Thx for advise!

daniel
  • 3,105
  • 4
  • 39
  • 48

1 Answers1

1

You could try to patch ctags so that it supports CSS. This guy explains how but I have no idea if it works or not. I'll probably give this solution a try very soon as I think this feature would kick ass.

Also, I should add that I didn't pull this old blog post from my magic bookmarks hat. It was one of the first results of a very simple Google query, did you look around before asking here? And, if you did, what did you found/try?

See also there and there.

edit

This solution doesn't require patching/compiling and works very well.

Community
  • 1
  • 1
romainl
  • 186,200
  • 21
  • 280
  • 313
  • I've used http://designtomarkup.com/vim/taglist-ctags-css-patch, and it worked fine (with the precompiled Windows binary). – Ingo Karkat Oct 22 '12 at 15:22
  • Thanks, I had seen that. However, I hope that a special parser is both faster and more robust than the regexp alternative you're mentioning. (E.g., I don't see the regexp handling multiple comma-separated definitions on the same line.) – Ingo Karkat Oct 22 '12 at 16:17
  • Those regexp patterns are used by ctags so I'd expect this solution to work reasonably fast. About the multiple comma-separated definitions: I *never* do that, maybe I should take a look at it. – romainl Oct 22 '12 at 16:30