Vim - 在 PHP 文件上激活 HTML 片段 [英] Vim - Activiting HTML snippets on PHP files

查看:27
本文介绍了Vim - 在 PHP 文件上激活 HTML 片段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用vim和snipMate,很多时候我需要将HTML文件命名为PHP,只是因为1或2行代码.

I am using vim and snipMate, many times I need to name the HTML files to PHP, just because of 1 or 2 lines of code.

我每次创建 PHP 文件时,vim 都将其作为 PHP 文件,因此 HTML 片段不可用,因此必须使用命令手动激活 HTML 片段.

I every time I create a PHP file vim takes it as PHP file and so the HTML snippets are not available, thus have to activate the HTML snippets manually with the command.

set ft=php.html

我打算在我的 vimrc 的这一行自动激活它

I intend to activate it automatically in this this line on my vimrc

autocmd BufREad, BufNewFile *.php set ft=php.html

这是正确的吗?我遗漏了什么或有什么问题吗?

Is this correct? I am missing anything or is something wrong?

推荐答案

您需要将其设为两个单独的指令.

You will need to make it two separate directives.

au BufRead *.php set ft=php.html
au BufNewFile *.php set ft=php.html

这篇关于Vim - 在 PHP 文件上激活 HTML 片段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆