Friday, November 1, 2013

7.4 html javascript indenting issues

I am using:
7.4 1-52

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

--
--
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 vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: