开发者

vim - html in php files: how to change tab size for html only

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜