How to recognize javascript libraries/frameworks in Vim?

376 views Asked by At

I've switched from Textmate to Vim for about a year ago, so I've been immersed in books, screencasts and forums about Vim, and how people customize their .vimrc's.

I'm not a beginner anymore, however by no means I'm an advanced or intermediate user, I'm in the stage when I feel confortable using Vim in an efficient way.

Here is the question:

How can I get the vim statusbar to show me which Javascript library/framework is in use? Obviously the most popular like jQuery, Prototype, YUI2/3, Dojo, etc.

Maybe it is just a trivial thing and some people may think that by looking at the code, you may be able to find which library is being used. But for the same reason, people has git, hg, rvm, tags, cwd showing in their statusline, I want to see that in my statusline.

1

There are 1 answers

0
Michael Dillon On

Basically, you need to write a vim script to do this and then put that in your .vimrc file.

If you have a vim containing Python or Ruby or PERL, then this is pretty straighforward, just look for a script tag with src=someframework and set the statusline.

But if you want a more general solution then you would need to learn the vim scripting language which is a bit of a chore. My suggestion would be to get a binary that includes a proper scripting language and roll your own solution.