Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding Keywords to Ruby syntax highlighting for Notepad++

Tags:

ruby

notepad++

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 like the other keywords. Can someone please advise?

like image 350
Kvass Avatar asked Jun 21 '11 19:06

Kvass


1 Answers

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:

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

like image 138
BoltClock Avatar answered Sep 28 '22 21:09

BoltClock