开发者

Adding Keywords to Ruby syntax highlighting for Notepad++

开发者 https://www.devze.com 2023-03-14 07:15 出处:网络
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:

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> 

However, even after updating this require and include are still not being highlighted l开发者_开发技巧ike the other keywords. Can someone please advise?


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

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

Adding Keywords to Ruby syntax highlighting for Notepad++

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.

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:

  • 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)

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

0

精彩评论

暂无评论...
验证码 换一张
取 消