1

Can anyone direct me to a tutorial on writing plugins for Jedit? I have a pipedream of using Jedit as an editor for SAS. Currently, it does syntax highlighting, but I feel it is or could be made better by fleshing out the ideas better.

A couple questions:

  1. Can you enable tab completion in Jedit?
  2. Can you specify "environments" that begin and end with certain syntax? (For instance, the word "keep" makes sense between the lines data xxx; and run; but not between proc sort data=xxx; and run; So highlighting it there would be counter-instructive to inexperienced coders.
  3. Can you store variables in a work place and reference them from a drop down menu (such as variable names in a dataset)
  4. Can you execute code from the shell/terminal and pipe .log files back into the Jedit message window?
Ross Rogers
  • 23,523
  • 27
  • 108
  • 164
AdamO
  • 4,283
  • 1
  • 27
  • 39

1 Answers1

1
  1. Are you talking about something like Microsoft's Intellisense or autocomplete? If so, a poor-man's approximation to auto-complete is to use the keyboard shortcut ctrl+b after typing in part of the word. It will complete the word based on all the words from all buffers that are open. See this questions for more on autocomplete.

  2. In your syntax highlighting, you can create delegate syntax for different chunks of code so that it will be highlighted according to different rules. grep in your jedit's mode directory for "delegate".

  3. Not exactly sure what you want, but jedit does keep track of a bunch of your latest copies from the text. Emacs calls this a "kill ring". For my jedit setup, I have Paste Previous... bound to ctrl+e ctrl+v. I believe that is the default shortcut binding. This will show you your last ~20 copies of text chunks and you can select which copy text chunk you want to use.

  4. Yes, you can execute tasks in the shell and pipe them back into jedit. See this question. The following is how I do bk edit and reload a buffer. It doesn't get output from the shell, but it does execute a shell command:

    import javax.swing.JOptionPane;
    import java.io.File;
    File f = new File(buffer.getPath());
    String SCCS_path = f.getParent()+"/SCCS";
    String bk_path =  "/usr/local/bin/bk";
    if ( !new File(SCCS_path).exists()) {
        bk_path = "/usr/bin/bk";
    }
    Runtime.getRuntime().exec(
        bk_path+ " edit "+
        buffer.getPath());
    Thread.currentThread().sleep(2000);
    buffer.reload(view);
    

Btw, macros are very powerful in jedit. You can record what you are doing in jedit with Macros->Record Macro...and it will generate the equivalent script.

Community
  • 1
  • 1
Ross Rogers
  • 23,523
  • 27
  • 108
  • 164
  • 1. My fav autocomplete is Unix term/bash. Press tab to show a list of a available options. ctl+space would be a suitable alternative. These options have to change depending on environment. If I type `proc freq data=xxx;` then `var` is an option up until I type `run;`. 3. When editing projects in SAS it's good to have knowledge about what libraries are mapped and what datasets live in each library. If I preprocessed SAS code to print outputs from those directories and pipe that info into jEdit, then jEdit would know what's there. Imagine calling "ls > dir.txt" and reading dir.txt into jEdit – AdamO Jan 22 '13 at 20:51
  • 1. [See this question](http://stackoverflow.com/questions/4661051/intellisense-in-jedit) for autocomplete in jedit. I'd bet that one of the Java language autocomplete add-ins is the best. [SideKick](http://plugins.jedit.org/plugins/?SideKick) seems to be the autocomplete framework to use. I think you can set the shortcut to whatever you like (including ctrl+space) in the shortcut options. Anyways, good luck! – Ross Rogers Jan 22 '13 at 23:08