Am 01.11.2013 13:57, schrieb David Fishburn:
I am using:
7.4 1-52

Thanks for reporting.

The standard vim74/indent/html.vim (version 0.9)

I have the following defined in my .vimrc

let g:html_indent_inctags = "body,html,head,p,tbody"
let g:html_indent_script1 = "inc"
let g:html_indent_style1 = "inc"

When I indent this entire file, I get these results:
***
<html><head>
         <script>
             var oButton = new Button({text: "Submit"});
             var oLayout = new layout.VerticalLayout("Layout1", {
content: [oLabel1, oTextField1,oLabel2, oTextField2, oButton]
});

oPanel.addContent(oLayout).placeAt("content");

// add handler to alert textfield values
oButton.attachPress(function() {
         var msg = "First Name: " + oTextField1.getValue()
         + "\n" + "Last Name: " + oTextField2.getValue();
         alert(msg);
         });

         </script>

     </head>
</html>
***

Notice how some of the JS code has indented right to column 1.

I was expecting something closer to this:
***
<html><head>
         <script>
             var oButton = new Button({text: "Submit"});
             var oLayout = new layout.VerticalLayout("Layout1", {
                 content: [oLabel1, oTextField1,oLabel2, oTextField2, oButton]
             });

             oPanel.addContent(oLayout).placeAt("content");

             // add handler to alert textfield values
             oButton.attachPress(function() {
                     var msg = "First Name: " + oTextField1.getValue()
                     + "\n" + "Last Name: " + oTextField2.getValue();
                     alert(msg);
             });

         </script>

     </head>
</html>
***

Is there anyway to fix this via settings?

Thanks,
David

I use cindent() for JavaScript indentation.  It is less than ideal.  I
know, cindent() can be configured using 'cinoptions', but I haven't
tried yet, because of a lack of good examples (like yours).

Problem 1: cindent() takes the string `content:' for a C-label.
Solution:  :setl cino+=J1

Problem 2: cindent() looks back indefinitely.  It should be possible to
specify a stopline to make it ignore non-JavaScript parts such as
    <html><head>
        <script>
For example, the following line
    oPanel.addContent(oLayout).placeAt("content");
still gets zero indent, yet I'm not sure why.

--
Andy

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to