R – How to add an edit mode to jEdit

editor, jedit, scala

While looking for a light-weight Scala development environment, I came upon an Scala edit mode for jEdit. I don't know how to put it to use, though. How does one put a new edit mode in jEdit?

Best Solution

All of this can be found inside jEdit's help, Using jEdit -> Writing Edit Modes -> Installing Edit Modes. But, if you are like me, and tried StackOverflow first, here's the short of it.

Place the mode file (in this case, scala.xml) inside the "modes" directory in jEdit home directory -- this can be found through the Utilities menu -- if you want it for all users, or the "modes" directory in user's jEdit's settings diretory -- which can also be found through the Utilities menu -- if the new mode is to be used by only one user.

After that, edit a file "catalog" inside that same directory. It contains a list of supported modes. If you are working on the settings directory, there won't be any examples to use as a reference, but the catalog inside the home directory has plenty.

A settings directory catalog would look like this, for the referenced mode:

<?xml version="1.0"?><!DOCTYPE MODES SYSTEM "catalog.dtd"><MODES><!-- Add lines like the following, one for each edit mode you add: --><!-- <MODE NAME="foo" FILE="foo.xml" FILE_NAME_GLOB="*.foo" /> --><MODE NAME="scala"      FILE="scala.xml"                FILE_NAME_GLOB="*.scala" /></MODES>