为 Notepad++ 的 Ruby 语法高亮添加关键字 [英] Adding Keywords to Ruby syntax highlighting for Notepad++

查看:28
本文介绍了为 Notepad++ 的 Ruby 语法高亮添加关键字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试添加 requireinclude 作为 Notepad++ 的 Ruby 关键字,但我遇到了一些问题.我将 langs.model.xml 文件的 ruby​​ 语言标签修改如下:

I am trying to add require and include as Ruby keywords for Notepad++, but I am having some trouble. I modified the langs.model.xml file's ruby language tag as follows:

<Language name="ruby" ext="rb rbw" commentLine="#">
  <Keywords name="instre1">__FILE__ and def end in or self unless __LINE__
     begin defined? ensure module redo super until BEGIN break do false
     next rescue then when END case else for nil retry true while
     alias class elsif if not return undef yield require include
</Keywords> 

然而,即使更新了这个 requireinclude 仍然没有像其他关键字一样被突出显示.有人可以请教吗?

However, even after updating this require and include are still not being highlighted like the other keywords. Can someone please advise?

推荐答案

Notepad++ 为此提供了一个接口,因此您应该使用它而不是修改应用程序文件.

Notepad++ provides an interface for this so you should use that rather than modify application files.

转到设置 > 样式配置器...,访问 Ruby 选项卡,选择 INSTRUCTION 类别,然后在那里添加两个关键字,如下所示:

Go to Settings > Style Configurator..., visit the Ruby tab, choose the INSTRUCTION category, and add the two keywords there so it looks like this:

使用更简单的接口提供的方法,您犯的真正错误是您修改了 langs.model.xml 文件,但忘记重命名它以覆盖原始 lang.xml.*.model.xml 文件是默认示例文件.

With the easier, interface-provided method out of the way, the real mistake you made is that you modified the langs.model.xml file, but forgot to rename it such that it overwrites the original lang.xml. The *.model.xml files are default example files.

根据的说法,您仍然可以修改 langs.xml 文件,以便为所有 Notepad++ 主题显示新关键字,但请确保:

And with that said, you can still modify the langs.xml file so that the new keywords appear for all Notepad++ themes, but make sure to:

  • 保存在 %AppData%\Notepad++ 而不是 %ProgramFiles%\Notepad++ 所以更新编辑器不会通过覆盖程序文件来恢复你的更改(假设%AppData% 正在使用)

  • Save in %AppData%\Notepad++ instead of %ProgramFiles%\Notepad++ so updating the editor doesn't revert your changes by overwriting program files (assuming %AppData% is being used)

备份原始 langs.xml 文件,以防万一您想恢复为默认值

Back up the original langs.xml file, just in case you want to revert to the default

这篇关于为 Notepad++ 的 Ruby 语法高亮添加关键字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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