Using jEdit

Alan Coelho 2017/06/01 03:07

This topics follows-on from

A good editor can save weeks of time over a year. Editors such as jEdit and NotePad++ can be fully customized. We will concentrate on jEdit; it is full featured with macros, panes, syntax highlighting, column editing, automatic updating of changed files and many Plugins. A Plugin is an add-on that extends functionality. Learning an editor takes a few days. Fortunately and for a particular individual, much of the functionality is not needed and after some use only a small subset of functionality is actually used; thus don't be intimidated by the many options.

jEdit macros allow communication between other programs and itself. For example a macro can be written to load the TOPAS technical reference. Another macro can be written to create a new TOPAS input file. After a few dozen macros the editing of INP files and the running of TOPAS becomes much easier. Here's a screen shot of jEdit with an INP file loaded.


Notice the three buttons on the top left of the screen (TA, TA-Arrow, New-INP); these are TOPAS specific buttons which has been added to jEdit; they communicate with TOPAS. First Timers should take a few minutes to go through the jEdit menus. On the left of the screen is the Plugin called XInsert. It's at present displaying an XML file that is TOPAS specific. Notice that text files read by TOPAS is shown under the Help tab. Clicking on these file names loads the file into jEdit. Example INP files can be loaded into jEdit by clicking on the example INP file name. There are over 100 examples referenced and each can be speedily run by clicking on the TA-arrow-icon, switching to TOPAS and then clicking in the TOPAS Run icon.

jEdit files/macros used for INP editing

The following files are necessary for editing INP files, they are zipped up here If you want a full jEdit installation with a few more things set up (e.g. templates, Durham menus then go to Johns jEdit page).

 inp-setup.bsh       Run this macro using "Macros/Run Other Macro"
 inp.insert.xml      XInsert XML file
 inp_mode.xml        INP Kewyords used in syntax highlighting
 inp.jedit-scheme    Colours for syntax highlighting

jEdit Macros


TA icons appearing in jEdit


Setting up jEdit for INP editing

Unzip jEdit.ZIP to a directory. From jEdit run the macro INP-Setup.BSH from the jEdit menu “Macros/Run Other Macro”. Follows the instructions which should take a minute. Exit jEdit and restart jEdit. All should then work.

Changing default key bindings

Key bindings can be easily changed from the menu option “Utilities/Global Options”:


The highlighted commands that begin with the text TA are macros written specifically for TOPAS. Suggested key bindings are:

A+`			Buffer Switcher
A+.			Hypertext search
A+1			Opening block comment
A+2			Closing block comment
A+s			XSearch Find/replace
A+w			Save current
C+PgDn			Next buffer
C+PgUp			Previous buffer
C+g			Go to Line
C+w			Close current buffer
C+UpArrow		Move up 9 lines (macro up_9)
C+DownArrow		Move down 9 lines (macro down_9)
C+0			Unsplit current 
C+1			Unsplit all 
C+2			Split horizontally 
C+3			Split vertically 

It is useful to go through these key bindings to get a feel for what is possible.

Using XInsert to write INP files

INP files can be swiftly composed using the XInsert hierarchical menus. Clicking on the items of the XInsert menus runs macros defined in the XInsert XML file (inp.insert.xml). For example, to insert an emission profile, place the cursor at the position where the emission profile is to be inserted and then click on the XInsert “Emission profile(s)” entry; doing so displays the standard emission profiles as follows:


Selecting CuKa2 produces the following:

Thus remembering the syntax of the emission profile as well as the keywords is not necessary.

Using Panes

Panes are similar to windows but they do not overlap; they are very useful when viewing and working with more than one file at a time. For example, when writing an INP file, it's often useful to grab INP text from parts of other files. Here's a screen shot showing three panes with the left pane being then one that is worked on.


Completing keywords

Keywords can be completed by pressing Ctrl-b. For example, typing 'vie' and then pressing Ctrl-b produces the following options:


Hypersearch, Alt+.

Place the cursor on a word and press Alt+. (ie. Alt and fullstop).

Getting a list of file names into an INP file

The Console Plugin is extremely useful for placing a list of file names into an INP file. For example, to get all of the data files in the directory test_examples\Absorption-Edge then the Console Plugin can be used in the following manner. First click on the Console Plugin Button at the bottom of the screen. Then type the following DOS commands and press Return at the end of each line:

 cd test_examples\absorption-edge
 dir *.raw

Note, when typing the 'cd' command, try pressing the tab key to complete the directory name; this saves a lot of typing. Note, it is important to learn the six DOS commands under the topic “Command line commands to know”. After 'dir' the screen should look like:


Now create a new INP file by clicking on the New-INP icon and copy the file-lines from the Console to the new file. Column select the text to the left of the file names; ie.


Press the delete key to have a list of file names only.

Users with Large screens

Place jEdit and TOPAS side by side on a single screen; the following gives an idea:


Personal Tools