vim - php文件中的html:如何仅更改html的选项卡大小

How to change the indent, tab size for HTML markup within PHP files? I dont want to change the indent size for php code. Desired tab sizes: HTML - 2, PHP - 4

so it looks like this:

<dl>
  <dt>Term</dt>
  <dd>
    <span>Definition</span>
  </dd>
  <dd>
<?php 
if ($a > $b) {
    echo $a;
    while ($c) {
        echo $d; 
    }
}
?>
  </dd>
</dl>

If this is to be done one time, I'd use (if there is not much code to be fixed) block-wise edit:

Ctrl+V I Space Space Esc

autocmd FileType html setlocal shiftwidth=2 tabstop=2
autocmd FileType php setlocal shiftwidth=2 tabstop=4

Add following code to your .vimrc file.