jEdit tips

While this page is sort of a beginner's guide to jEdit, it is by no means a replacement for the jEdit 4.2 User's Guide located in the jEdit help system: Help → jEdit Help.

toolbar

In addition to the usual editing buttons on jEdit's toolbar these are particulary useful:

-. open Plugin Manager dialog to install, remove, load, and unload plugins
-. open Global Options dialog to make persistent changes to options
-. open Buffer Options dialog to make temporary changes to options on the current file (buffer) in the editor
-. open Help system
-. remove split windows
-. split window, top/bottom
-. split window, left/right

plugin manager

jEdit is meant to be used with a set of plugins installed that suit your particular needs. Use PluginsPlugin Manager to get and manage plugins — or on the toolbar.

Recommendation: install and play with plugins one-by-one rather than grabbing a large set of them at once — they vary greatly in resource use and a few are not of the quality you might wish for. See my suggested plugin list.

Here is the Plugin Manager dialog:

Press Download Options… button on the Plugin Manager dialog and set these options (you only have to do this once, your choices are saved persistently):

  • check – Download plugin source code if you want the source code in addition to the jar file
  • check – Delete archives from download directory after install; I'm not aware of any reason to keep them
  • select – install plugins in jEdit settings directory
    • so when you update jEdit you don't have to worry about your settings
    • look under Utilities → Settings directory to see where this is on your computer
  • press update mirror list and select the mirror near you. Note: it may take a few seconds to display the list during which you get no visual feedback.

Now to get the plugins, press the OK button to go back to the main Plugin Manager screen and

  1. click – Install tab. The list of plugins will appear possibly after a short wait.
  2. click – the Name column heading to sort the list by name
  3. check – the box next to each of the plugins you want. Note: don't check – select all. There are no circumstances in which that makes sense.
  4. press – the install button

Some older plugins require you to restart jEdit; a message box will pop up if this is the case.

accessing plugin functions

Use the Plugins menu to access plugin functions. See keyboard shortcuts to setup more convenient access to the ones you find yourself using frequently and to see what additional plugin functionality might available in addition to that found on the Plugins menu.

Look also for dockable windows the plugin might provide.

Plugins also may extend jEdit's Help system; look at the bottom of the Help categories.

plugin help and options

Notes:

  • When a plugin is installed it extends jEdit's help system. You will find help information for individual plugins at the bottom of the help categories list.
  • A plugin's options, if it offers any, are set with Plugins → Options.

global options

Use UtilitiesGlobal Options to set global options — or on the toolbar.

jEdit has a rather vast array of options. The rest of this section provides some notes on some of them. Note: Global Options are persistent; to change options temporarily on the current file (buffer) use UtilitiesBuffer Options.

Options addressed in this section:

dockable windows

jEdit itself and many plugins provide dockable windows: windows that can be "docked" on left, right, top, or bottom of the editor and accessed by clicking on their tab.

Here's a screenshot of jEdit with windows docked at the left, right, and bottom:

Clicking on a tab/button for a docked window open or closes it. Right-clicking produces this menu

so you can easily change the position of the window. Notice at each docking location there these controls in addition to the window tabs. The X closes an open window.

Use Global Options to dock windows for a new plugin and see/changes the settings for all available docakable windows:

Most dockable windows have a natural vertical or horizontal orientation. XAA for example is vertical so dock it on the left or right.

editing modes

Editing modes provide syntax highlighting as well as default settings like tab width and word wrap for files based on the filename extension. jEdit comes with over 100 mode files for everything from programing languages like Java, PHP, and C to HTML, XML, and Apache configuration files.

Note: Xilize provides an editing mode for Xilize sources. See download to get xilize.xml and setup directions.

You can change the default behavior of a modes in Global Options:

Use the Change settings for mode drop down list to select the mode you wish to change.

For Xilize mode do not chage these unless you know what you are doing:

  • explicit Folding mode
  • soft Word wrap
  • *.{xil,xilinc} File name glob (unless adding to it)

It is also a good idea to keep Soft (emulated with spaces) tabs so any pre. (<pre>) markup does what you expect.

keyboard shortcuts

A quite large collection of actions can be assigned to keyboard shortcuts. jEdit defines actions this way:

Actions define procedures that can be bound to a menu item, a toolbar button or a keyboard shortcut. Actions are short scripts written in BeanShell, jEdit's macro scripting language. These scripts either direct the action themselves, delegate to a method in one of the plugin's classes that encapsulates the action, or do a little of both. — from jEdit's Help system.

All of jEdit's menu items and common editing commands are available as actions and virtually every plugin provides actions to access its functionality. Use Global Options to assign a keyboard shortcut to an action:

Use the Edit Shortcuts drop down list to display the action set you want to work with. There are three types of action sets:

  • built in commands
  • macros — the ones included by jEdit as well as ones you create
  • plugin provided actions

Pick the one you want and jEdit will give you a table of actions available in that set and their current keyboard shortcuts. To assign a new shortcut, just click in the table and press the keys you want to assign the action to. jEdit warns you if you are about to overwrite an existing shortcut.

Note:

  • MacrosMiscDisplay Actions will create a new buffer with a listing of all actions available. The file uses explicit folding, so expand the folds to see what is there.
  • MacrosMiscDisplay Shortcuts will pop up a dialog listing all the actions that have been assigned keyboard shortcuts.

text area

"Text area" refers to the part of the editor where you type and edit text.

Its Global Options:

The wrap guide can be useful and, when white space at the end of the line is meaningful, the End of line markers.

file system browser: colors

It is quite useful to have the file system browser color filenames based on the filename extension.

Press the + button to add entries into the table.

FSB, file system browser

FSB provides quick access to a lot functionality — if only you know that it is available. This section attempts to show some of its most useful features.

Here is the FSB fully expanded:

Note:

  • FSB has its own toolbar
  • the upper pane contains a tree view of directories with the directory of the current file highlighted
  • the lower pane contains a tree view of the selected directory, including its subdirectories, with information on each file in that directory
  • the filenames in the lower pane are colorized based on their file extension.

In this example a filter is active which means only files with names conforming to the filter are shown. We know the filter is active because of the checkmark in the checkbox.

for Xilize v3.0 use *.{xil*,css,js,bsh} for a file filter.

This is another view of the same directory with FSB width reduced and file filtering turned off. Note: more files types are displayed, in fact all of them.

Also note

  • the Commands, Plugins, Favorites buttons use the symbol to indicate they have pulldown menus available.
  • the Path and Filter text boxes use the symbol to indicate you can get at previous values

Under the Commands button:

  • Directory of Current Buffer sets the FSB to show the directory of the active file in the editor
  • Search in Directory... pops up the Find/Replace dialog set up to search in the current directory and its subdirectories

Favorites acts like bookmarks in a web browser. You can add and edit direct links to directories you would like to display in the FSB and files that you want to load in the editor.

Also note that a right-click on a directory or file pops up a menu with, among other items, commands to Rename and Delete (if the file is not loaded in the editor).

The Plugins button menu is sometimes extended by plugins — the FTP plugin for example.

abbreviations

jEdit abbreviations (not to be confused with Xilize abbreviation markup [ ]) do what you would expect. You type in a few characters, press a special key, and the abbreviation you typed is expanded into its full form. You can create your own abbreviations on the fly.

Try this:

  1. type: ex
  2. press: Cntrl-; (hold down the control key and press the semicolon)
  3. put a few words in the before and after parts of the dialog – doesn't matter what they are for this example
  4. click on Add global

Again, you should see the abbreviation replaced with it's expansion. Now test the abbreviation you just created to get the feel of using this feature:

  1. type: ex
  2. press: Cntrl-;

You should see the abbreviation replaced with it's expansion.

Edit abbreviations with Global Options → jEdit → Abbreviations and notice the Abbrv set drop down list to get to the mode specific sets.

folding

jEdit has several folding modes. The one discussed here, explicit folding, works with comment lines containing {{{ and }}} to mark the beginning and end of a fold. (The single line comment marker is >xil> for Xilize files.) Good use of explicit folds makes working with large files easier.

The following screenshot shows a file with all folds collasped. See below for an explanation.

All folds collasped in jEdit — click the screenshot to see it fullsize.

The gray vertical area on the left with the small triangles and line numbers is called the gutter in jEdit terminology. (Displaying line numbers is toggled under the View menu.) Each triangle in the gutter toggles a fold. Notice some line numbers are missing due to folding.

The next screenshot shows the same file with one fold expanded.

One fold expanded in jEdit — click the screenshot to see it fullsize.

Notice the triangle at line 380 points downward indicating an expanded fold. The L-shaped symbol on line 385 shows the end of the fold. Clicking on a triangle opens and closes the fold.

A few notes:

  • folds may be nested, for simplicity that's not shown here
  • folds do not have to be around headings although that's often a natural place for them. However, it would make sense to surround a big table or list with a fold as well. Do what suits you.
  • any text can go after the {{{ at the top of a fold, the custom is to put something meaningful there like the heading line in the examples above.
  • the Folding menu contains commands – and keyboard shortcuts – for a variety of folding oriented commands.

folding macro: See below for a macro that creates an explicit fold around selected text.

macros

The jEdit 4.2 User's Guide Writing Macros chapter tells you everything you need to know about jEdit's sophisticated macro capability. However, you can create useful macros quite easily with MacrosRecord Temporary Macro to create and save useful macros as was done to create the example below.

The following macro for creating an explicit fold around selected lines can be pasted into a file and saved in your macro directory (see Utilities → Settings directory → macros). It will then appear in the Macros menu and you can assign a keyboard shortcut to it (Utilities → Global Options... → Shortcuts).

To use it, first select the lines to be included in the new fold, then execute the macro. It will

  • create the fold,
  • copy the first line of the selected text as the fold comment,
  • collaspe the fold, and
  • add a new blank line after the fold.
// File:  fold.bsh
// Highlight text to fold then run this macro to create an explict fold.
// The top line of the selected text will be copied to the first fold comment line.
if(textArea.getSelectionCount() == 0 )
    return;
textArea.addExplicitFold();
textArea.goToNextLine(false);
textArea.goToStartOfWhiteSpace(false);
textArea.goToEndOfWhiteSpace(true);
Registers.copy(textArea,'$');
textArea.goToPrevLine(false);
textArea.goToEndOfWhiteSpace(false);
Registers.paste(textArea,'$',false);
textArea.collapseFold();
textArea.goToStartOfWhiteSpace(false);
textArea.goToNextLine(false);
textArea.insertEnterAndIndent();

Xilize mode setup

In is incredibly useful to have the Xilize mode file installed when you are editing Xilize source files — one useful feature is syntax highlighting. Use the Xilize option pane to install the mode file.

recommended plugins

You only need the Xilize plugin to run Xilize (to get the current version see download. However, this minimal set is very useful:

  • BufferTabs, use tabs to switch between files in the editor
  • Console, run command line programs from within the editor

If you are developing for the web, try these:

  • FTP, edit files on a remote machine
  • AntFarm, interface to running the ant build system
  • XML, for intelligent editing and validation of XML files
  • XML indent, indenter for XML files
  • JDiff, shows differences in two files side-by-side — an excellent diff utility

As is the case for all plugins, look in PluginsPlugin Options... for configuration options and UtilitiesGlobal Options...Docking for dockable windows.

miscellaneous tips

These are just some of the conviences provided by jEdit, ones you may not notice right away.

right-click pop-up menus

Some of the useful commands found on the pop-up menus are:

  • text area pop-up
    • To Lower Case — make selected text lower case
    • HyperSearch for Word — hypersearch for selected text
    • Customize This Menu... — add any command or macro to the menu
  • File System Browser for:
    • Search in Directory... — hypersearch in files in a directory and its subdirectories
    • Delete and Rename... files (as long as the file is not loaded in the editor)
  • docking tabs
    • change location of docked window
  • buffer tabs
    • copy path or name of current file

some useful commands and shortcuts

command shortcut description
insert line comment Control-e Control-k add line comment string at beginning of current line or, if multiple lines selected, at beginning of all selected lines.
rectangular selection Alt-\ select arbitrary retangular areas — great for inserting/pasting the same text on each line
vertical paste Control-e Control-p paste a region that was selected using rectangular selection and copy
delete line Control-d delete current line
join lines Control-j join the current line with the next line
collaspe all folds Control-e c
expand all folds Control-e x
narrow to fold Control-e n n clear away all text except that in the current fold, use expand all folds to make all text visible again

autoset file properties

jEdit 4.2 User's Guide → Using jEdit → Customizing jEdit → Buffer-Local Properties lists all possible properties for a file. A line like

>xil> :indentSize=4:noTabs=true:mode=xilize:collapseFolds=1:

in the first 10 or last 10 lines of a file will set the properties given when the file is loaded into the editor

status bar

The status bar at the bottom of the jEdit window not only provides status information but allows you to change some of the current settings with a mouse click.

In this snapshot of the right-hand portion of the status bar there are three distinct areas:

(xilize,explicit,ISO-8859-1) respectively: editing mode, folding mode, character encoding. Double clicking in this area will bring up the Buffer Options dialog from which you can change them.
S — — — U put your mouse pointer over each to see its tooltip description, clicking on one of these indicators will toggle its value. The S in this example means soft word wrap; it will cycle to hard and none with each mouse click.
7/13 MB is a memory use indicator. Double click on it to force garbage collection.