我在Vim中编辑PHP并且喜欢自动缩进,但PHP的替代语法不会自动缩进我想要的方式.例如,在HTML模板中,Vim不会像使用大括号时那样识别打开的控件结构.例:
<html>
<body>
<p>
<?php if (1==1): ?>
This line should be indented.
<?php endif; ?>
</p>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我希望Vim识别开放控制结构并缩进其中的HTML.另一个使用纯PHP的例子:
<?php
if (1==1):
echo "This line gets indented";
echo "This one doesn't";
endif;
?>
Run Code Online (Sandbox Code Playgroud)
即使控制结构仍处于打开状态,分号也会以分号结束.
有人知道如何让Vim在这些情况下工作吗?谢谢.