I have been using Vim for a while, and I cannot get the correct HTML indentation working in PHP files.
For example, I want each tab to be indented one tab more than the parent, as shown below.
<?php if(isset($sports)) { <div> <label>Uniform Size</label> <ul> <li class="left"><label for="s" class="small">S</label><input type="radio" name="size[]" value="S" id="s" class="radio" /></li> <li class="left"><label for="m" class="small">M</label><input type="radio" name="size[]" value="M" id="m" class="radio" /></li> <li class="left"><label for="l" class="small">L</label><input type="radio" name="size[]" value="L" id="l" class="radio" /></li> <li class="left"><label for="xl" class="small">XL</label><input type="radio" name="size[]" value="XL" id="xl" class="radio" /></li> </ul> </div> <?php } ?>
Using the PHP-correct-Indent script, the code will be formatted as follows:
<?php if(isset($sports)) { <div> <label>Uniform Size</label> <ul> <li class="left"><label for="s" class="small">S</label><input type="radio" name="size[]" value="S" id="s" class="radio" /></li> <li class="left"><label for="m" class="small">M</label><input type="radio" name="size[]" value="M" id="m" class="radio" /></li> <li class="left"><label for="l" class="small">L</label><input type="radio" name="size[]" value="L" id="l" class="radio" /></li> <li class="left"><label for="xl" class="small">XL</label><input type="radio" name="size[]" value="XL" id="xl" class="radio" /></li> </ul> </div> <?php } ?>
Even with HTML indentation, which I then add to the PHP code, the indentation is ignored, moving new lines of HTML code without any indentation.
So, is there a way to get the indentation format that I want to work with HTML in PHP files using Vim?
html vim php indentation
Sasha Jan 19 '09 at 22:39 2009-01-19 22:39
source share