I use vim for web development. These are almost always .php files, which also contain HTML and sometimes Javascript. While working in a block of PHP, indenting works fine. The syntax highlighting is okay, but only really useful for the PHP-code. When I want to edit an HTML block, I usually switch: :set ft=html
, so that highlighting and indenting work well for that. Of course, I keep switching back and forth, which is time-consuming. I'd like to have all three languages' highlighting and indenting intelligently combined. Being able to =G
the whole file at once and have it work for each block according to its own rules would be fantastic.
我使用vim进行Web开发。这几乎总是.php文件,它们也包含HTML,有时还包含Javascript。在PHP块中工作时,缩进工作正常。语法高亮是可以的,但只对PHP代码非常有用。当我想编辑一个HTML块时,我通常会切换:: set ft = html,这样突出显示和缩进工作就可以了。当然,我一直来回切换,这很费时间。我希望将所有三种语言的突出显示和缩进智能组合在一起。能够一次= G整个文件,并根据自己的规则让每个块工作将是太棒了。
While I know that "I can do this myself", I somehow doubt that I'm the first person wanting this, and I'm looking for an existing solution.
虽然我知道“我可以自己做”,但我怀疑我是第一个想要这个的人,我正在寻找一个现有的解决方案。
Can anyone help me out?
谁能帮我吗?
2 个解决方案
#1
4
I haven't tried this, but what about Better indent support for php with html.
我没有尝试过这个,但是对于带有html的php更好的缩进支持呢。
#2
1
Hope this might help you.. https://github.com/2072/PHP-Indenting-for-VIm
希望这可以帮助你.. https://github.com/2072/PHP-Indenting-for-VIm
and Why dont you use gedit as the editor its light weight and supports well for various file types. just a suggestion for you.
为什么不使用gedit作为编辑器,它的重量轻,并支持各种文件类型。只是给你一个建议。
#1
4
I haven't tried this, but what about Better indent support for php with html.
我没有尝试过这个,但是对于带有html的php更好的缩进支持呢。
#2
1
Hope this might help you.. https://github.com/2072/PHP-Indenting-for-VIm
希望这可以帮助你.. https://github.com/2072/PHP-Indenting-for-VIm
and Why dont you use gedit as the editor its light weight and supports well for various file types. just a suggestion for you.
为什么不使用gedit作为编辑器,它的重量轻,并支持各种文件类型。只是给你一个建议。