覆盖 Textmate 语言代码着色
在 htaccess 的帮助下,我成功地将 php 合并到我的 css 文档中。这样做的问题是,textmate 看到文档有 php 标签,并且通过 css 对该语言进行颜色坐标。他们是否要手动来回切换(不删除 php 并保存文件)?
With a little bit of help from htaccess I managed to incorporate php inside my css documents. The problem with this is that textmate sees that the document has php tags and color coordinates that language over css. Is their anyway to switch back and forth manually (without removing php and saving the file)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用文档窗口底部的下拉菜单手动更改文件的语言。这个粗略注释的屏幕截图显示了以下位置:
You can manually change the language of a file using the drop-down menu at the bottom of a document window. This crudely annotated screenshot shows where:
您的文件的扩展名是什么? .php 还是 .css?
窗口底部的语言选择菜单对您的文件有何说明? PHP 还是 CSS?如果将其中一个更改为另一个会发生什么?
你的档案怎么样了?
或
body { 背景颜色: ; } ...
?TextMate 的主题是围绕范围概念构建的。如果您的文件看起来像我的第一个示例,那么您放入 PHP 块内的所有 CSS 部分很可能会因为其范围而被 TextMate 视为 PHP。
我不记得键盘快捷键,但主题创建包中有一个命令可以显示光标下单词/字符的范围。把它写下来,然后转到“首选项”窗口并编辑您的主题,以便 PHP 范围内的 CSS 范围看起来像普通的 CSS。
What is the extension of your file? .php or .css?
What does the language-selection menu at the bottom of the window says about your file? PHP or CSS? What happens if you change one for the other?
How is your file?
<?php ... all your css ... ?>
orbody { background-color: <?php echo $todaysBgColor; ?>; } ...
?TextMate's theming is build around the notion of scope. If your file looks like my first example, there is a big chance all the CSS parts that you put inside of a PHP block are going to be treated as PHP by TextMate because of their scope.
I don't remember the keyboard shortcut but there is a command in the theme-creation bundle that shows you the scope of the word/character under the cursor. Write it down, then go to the Preferences window and edit your theme so that a CSS scope within a PHP scope looks like normal CSS.