////////////////////////// With javascript.vim http://www.vim.org/scripts/script.php?script_id=1491
$(function(){
var foo // code starts here,
// The following line breaks things, but adding a comment to it fixes things
({a:1})
var foo // everything is stuck left now.
({a:1})
var foo // previous line justifies all following lines wherever you put it
function flat(){
var foo // function starts out right, but the next line dedents it
({a:1})
var foo
}
var foo // now we're over here
if (foo) {
var foo // this if block doesn't close properly
} else if (foo){ // add a comment here to dedent the else body
var foo
} else if (foo){
var foo
} // add a comment here to indent and break the following lines
var foo
})
// all parenthesis match, but yet our indentations don't
///////////////////////// With vanilla vim
$(function(){
var foo // code starts here,
// The following line breaks things, but adding a comment to it fixes things
({a:1})
var foo // everything is stuck left now.
({a:1})
var foo // previous line justifies all following lines wherever you put it
function flat(){
var foo // function starts out right, but the next line dedents it
({a:1})
var foo
}
var foo // now we're over here
if (foo) {
var foo // this if block doesn't close properly
} else if (foo){ // add a comment here to dedent the else body
var foo
} else if (foo){
var foo
} // add a comment here to indent and break the following lines
var foo
})
// all parenthesis match, but yet our indentations don't
//////////////////// With this plugin http://vim.wikia.com/wiki/Improved_Javascript_Indent_script_for_Vim
$(function(){
var foo // code starts here,
// The following line breaks things, but adding a comment to it fixes things
({a:1})
var foo // everything is stuck left now.
({a:1})
var foo // previous line justifies all following lines wherever you put it
function flat(){
var foo // function starts out right, but the next line dedents it
({a:1})
var foo
}
var foo // now we're over here
if (foo) {
var foo // this if block doesn't close properly
} else if (foo){ // add a comment here to dedent the else body
var foo
} else if (foo){
var foo
} // add a comment here to indent and break the following lines
var foo
})
// all parenthesis match, but yet our indentations don't