Skip to content

Syntax Coloring for R in jEdit

The editor is jEdit.

To install R syntax coloring I use the R syntax (r.xml v1.0 by Jose Claudio Faria) from the community site. Direct download is here. Then follow those instructions:

(this is for 4.2 — for v 4.3 see below)

1.Copy the r.xml into the modes directory under the jedit install in the Applications folder.

2. Open the file called catalog in the mode directory in a simple text editor and add the new edit mode here. Scroll down and add a line for R and comment out the line for rebol, like this:

...

<MODE NAME="R"; FILE="r.xml"
FILE_NAME_GLOB="*.r" />

<!-- <MODE NAME="rebol" FILE="rebol.xml"
FILE_NAME_GLOB="*.r" /> -->

...

See the Installing Modes section of the jEdit user’s guide for details.

3. Start jEdit. Go to Utilities>Global Options. Under Editing set Default edit mode to R.
Edit modes can also be changed by doubleclicking near the bottom right of the jedit window.
The colors and styles used to highlight syntax tokens can be changed in the Syntax Highlighting pane of the Utilities>Global Options dialog box; see the section called “The Syntax Highlighting Pane”.

Note that different from “emacs speaks statistics” (on Mac) and Tin-R, jEdit cannot send commands directly to R to process. It is the old copy & paste.

No TweetBacks yet. (Be the first to Tweet this post)

Categories: R.

Tags: ,

Comment Feed

6 Responses

  1. Any idea why it's not working anymore with jEdit 4.3pre13?
    Thanks,
    Adrian

    Adrian DusaJune 6, 2008 @ 5:03 amReply
  2. Yes.
    To use it with version 4.3 you need to ctrl-click on the App. icon and say "show package contents", then navigate to Resources -> Java and find the modes folder. Edit the entry for R in the catalog file and put the r.xml file there.

    Claudia EngelJune 6, 2008 @ 9:01 amReply
  3. For some reason, Java or JEdit doesn't like the accent marks in Jose Claudio's name. Edit these out in the r.xml file and the problem is fixed.

  4. The accents doesn't work, because they are not encoded with UTF-8, which is default for every XML file.

    Just open r.xml with ISO-8859-1 encoding, change it to UTF-8, save and it will start to work.

  5. If you don't take out the quotes from the text below and replace them with standard ones it causes JEdit to hang.... (might be a good idea if Claudia edited the text in this post to reflect this as this seems to be a common error judging by you comments - i also had this problem)

    Don't use this (same as above) :

    <!-- –>

    USE THIS instead (the quotes have been substituted for the correct ones) !!

    <!-- –>

    phatrickApril 28, 2009 @ 8:22 amReply
  6. If you don't take out the quotes from the text below and replace them with standard ones it causes JEdit to hang.... (might be a good idea if Claudia edited the text in this post to reflect this as this seems to be a common error judging by you comments - i also had this problem)

    Don't use this (same as above) :

    <!--

    <!-- –>

    USE THIS instead (the quotes have been substituted for the correct ones) !!

    <!-- –>

    -->

    phatrickApril 28, 2009 @ 8:24 amReply



Some HTML is OK

or, reply to this post via trackback.