douhao6557 2013-04-10 16:47
浏览 51

vim:在HAML中使用php语法高亮显示:php filter [关闭]

I'm using the :php HAML filter that is supplied with haml-contrib to write blocks of php code inside a haml file.

this allows me to write:

!!! 5
%html
     %body
     -# HAML code ...
     :php
         // php code ...

I want to hightlight the php code in vim using this vim-tip. However, the default php syntax file that is supplied with my stock vim only highlights php code that is inside <?php ,?> tags.

How can I get around this?

Note that I can get the vim-tip to work, so highlighting the following:

!!! 5
%html
     %body
     -# HAML code ...
     :php
         <?php
              // php code ...
         ?>

does work! It just creates bad HAML output (double <?php ... ?> tags) and doesn't reflect the simplicity I want to achieve using HAML.

  • 写回答

1条回答 默认 最新

  • dougu4704 2013-04-10 16:52
    关注

    It's more along the lines that you need updated HAML syntax rules that allow vim to detect when you're going from haml->php.

    Remember, there's no such thing as a "php script". There's only files which have php code blocks embedded in them, and those code blocks are delimited with <?php ... ?>. There's no way for vim's php rules to directly detect that you've broken into php mode, because you don't have the <?php to signal that.

    评论

报告相同问题?

悬赏问题

  • ¥15 孟德尔随机化结果不一致
  • ¥20 求用stm32f103c6t6在lcd1206上显示Door is open和password:
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法