Correct indentation of HTML and PHP using Vim

前端 未结 10 467
悲&欢浪女
悲&欢浪女 2020-11-29 20:02

I\'ve been using Vim for a while, and I can\'t get proper HTML indentation working in PHP files.

For example, what I want is for each child to be indented one tab mo

10条回答
  •  自闭症患者
    2020-11-29 20:14

    php-correct-indenting only cares about your PHP, and assumes the readability of the HTML is of no interest. An XML indenter would position the tags nicely, but wouldn't be able to indent the contents of a processing instruction to match. Maybe there is an indentation script that understands both the C-like syntax of PHP the programming language and [X][HT]ML the markup language being templated, but I've never met one yet - sorry.

    Still, I'd like to fiddle with the indenting in your example even before php-correct-indenting mauled it! The

    element is inside an outer if-statement, but I have no way to see that from the indenting. I'd suggest something like:

    
        
        
    • etc. etc.

提交回复
热议问题