Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to recognize javascript libraries/frameworks in Vim?

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.

like image 927
Jose Elera Avatar asked Feb 04 '11 02:02

Jose Elera


1 Answers

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.

like image 68
Michael Dillon Avatar answered Sep 25 '22 10:09

Michael Dillon