background preloader

Vim & javascript

Facebook Twitter

JavaScript Indent - Javascript indenter (HTML indent is included) Hosted at: *Update: (3/30/11) - Release Candidate 1.0 - Progress Started. *Update: (5/14/10) - Beta 3.0 Released (See Below) (First Release Candidate) *Update: (5/6/10) - Beta 2.2 Released (See Below) *Update: (5/6/10) - Beta 2.1 Released (See Below) *Update: (5/5/10) - Beta 2.0 Released (See Below) *Update: (5/3/10) - Beta 1.0 Released (See Below) Summary: ================================================================================ I wrote this basically due to the lack of any good javascript indent plugin out there.

And due to javascripts lax syntactical structure cindent() just wont cut it. var y = [ x, y, z ] t; // no indent Handles all basic control structures (with or without leading '{'): if(x) // comment y; z; Handles multi-line function declarations: var x = function( y, // notice one tab over z, w) { t; } Handles multi-line control structure statements: if( x == y || y == z || z == w) { t; } JavaScript syntax - Better JavaScrirpt syntax support.

Taglist-plus - Source code browser with awesome Javascript support. Awesome vim support for javascript with jsctags and taglist-plus | discontinuously.com. Exuberant-Ctags is a great way to navigate through code, but it doesn’t work so well for Javascript due to the complexity of parsing the language. Fortunately, the fine folks at Mozilla have made jsctags, which handles the job pretty darn well by using an inbuilt Javascript parser. Given the following code, var objectNamespace = {}; objectNamespace.num = 1; objectNamespace.func = function() {}; Jsctags produces: As you can see, jsctags is able to identify all the variables and methods, the namespaces they belong to, and even their types! Here are a couple more examples, using a variety of techniques from Angus Croll’s post on Namespacing in Javascript: In every case, jsctags successfully infers the ‘namespace’ of the function, despite the fact that this namespace was declared in a different manner each time!

Module Pattern 3 is a particularly impressive display of jsctag’s capabilities: The binding of this, set via the .apply() method, is resolved correctly. Installation Usage Related Posts. Jslint.vim - Check JavaScript files for errors with JSLint. Simplecommenter - simple commenter.