Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Apr 30th, 2010  |  syntax: JavaScript  |  size: 2.74 KB  |  views: 264  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. ////////////////////////// With javascript.vim http://www.vim.org/scripts/script.php?script_id=1491
  2. $(function(){
  3.     var foo // code starts here,
  4.     // The following line breaks things, but adding a comment to it fixes things
  5. ({a:1})
  6. var foo // everything is stuck left now.
  7.           ({a:1})
  8.           var foo // previous line justifies all following lines wherever you put it
  9.  
  10.           function flat(){
  11.               var foo // function starts out right, but the next line dedents it
  12.           ({a:1})
  13.           var foo
  14.       }
  15.       var foo // now we're over here
  16.       if (foo) {
  17.           var foo // this if block doesn't close properly
  18.           } else if (foo){ // add a comment here to dedent the else body
  19.           var foo
  20.           } else if (foo){
  21.               var foo
  22.               } // add a comment here to indent and break the following lines
  23.               var foo
  24.               })
  25.               // all parenthesis match, but yet our indentations don't
  26.  
  27. ///////////////////////// With vanilla vim
  28. $(function(){
  29.         var foo // code starts here,
  30.         // The following line breaks things, but adding a comment to it fixes things
  31.         ({a:1})
  32.         var foo // everything is stuck left now.
  33.         ({a:1})
  34.         var foo // previous line justifies all following lines wherever you put it
  35.  
  36.         function flat(){
  37.         var foo // function starts out right, but the next line dedents it
  38.         ({a:1})
  39.         var foo
  40.         }
  41.         var foo // now we're over here
  42.         if (foo) {
  43.         var foo // this if block doesn't close properly
  44.         } else if (foo){ // add a comment here to dedent the else body
  45.         var foo
  46.         } else if (foo){
  47.         var foo
  48.         } // add a comment here to indent and break the following lines
  49.         var foo
  50. })
  51. // all parenthesis match, but yet our indentations don't
  52.  
  53. //////////////////// With this plugin http://vim.wikia.com/wiki/Improved_Javascript_Indent_script_for_Vim
  54. $(function(){
  55.     var foo // code starts here,
  56.     // The following line breaks things, but adding a comment to it fixes things
  57.     ({a:1})
  58.     var foo // everything is stuck left now.
  59.     ({a:1})
  60.     var foo // previous line justifies all following lines wherever you put it
  61.  
  62.     function flat(){
  63.         var foo // function starts out right, but the next line dedents it
  64.         ({a:1})
  65.         var foo
  66.     }
  67.     var foo // now we're over here
  68.     if (foo) {
  69.         var foo // this if block doesn't close properly
  70.     } else if (foo){ // add a comment here to dedent the else body
  71.         var foo
  72.     } else if (foo){
  73.         var foo
  74.     } // add a comment here to indent and break the following lines
  75.     var foo
  76. })
  77. // all parenthesis match, but yet our indentations don't
clone this paste RAW Paste Data