# jEdit Basics

## Interface Overview

A View is the jEdit term for an editor main window. It is possible to have multiple views open at once, and each View can be split into multiple panes. jEdit remembers the state of open views between editing sessions.

An open file is referred to as a Buffer. Unlike some editors where each buffer gets its own View, jEdit completely separates the two concepts. A buffer might be visible in several views, or none at all.

A TextArea is an editor for a buffer. An EditPane contains a TextArea plus optional buffer switcher. A View contains one EditPane by default, and additional panes are created whenever the View is split.

The drop-down buffer switcher list at the top of each EditPane shows a BufferSet, or a set of open buffers (see ). Selecting a buffer on this list will make it visible in the TextArea. Different emblems are displayed next to buffer names in the list, depending the buffer's state; a red disk is shown for buffers with unsaved changes, a lock is shown for read-only buffers, and a spark is shown for new buffers which don't yet exist on disk.

With the new Tango icon theme, these symbols are slightly different, a red square is shown for buffers with unsaved changes, a lock is shown for read-only buffers, and a yellow square is shown for new buffers which don't yet exist on disk.

As with most other graphical applications, there is a tool bar at the top of the View which provides quick access to frequently-used commands. Also, clicking the TextArea with the right mouse button displays a popup menu which also facilitates quick access to various commands. Both the tool bar and the right-click menu can be completely customized to suit your tastes in the Utilities>Options dialog box; see and .

Most of the View is taken up by the TextArea. If you've ever used a graphical user interface before, the TextArea will be instantly familiar. Text can be inserted simply by typing. More details on text insertion and deletion can be found in .

The strip on the left of the TextArea is called a gutter. The gutter displays marker and register locations, as well as folding arrows; it will also display line numbers if the View>Line Numbers (shortcut: C+e C+t) command is invoked. Note this menu toggle action has the side-effect of changing the persistent jEdit properties for the Gutter, which can also be set from the Gutter pane of the Utilities>Options dialog box.

The gutter is divided into two sections. Right-clicking on the left side gives you a context menu, while right-clicking on the right side (where line numbers might be) toggles a marker at that position. Text can be selected by left-clicking and dragging on right side of the gutter, over the range of lines you wish to select.

## Multiple Views

As documented at the beginning of this chapter, multiple Views (main windows) can be open at once.

View>New View creates a new View, or main window.

View>New Plain View creates a new View but without any tool bars or dockable windows. This can be used to open a small window for taking notes and so on.

View>Close View closes the current View. If only one View is open, closing it will exit jEdit, unless background mode is on; see for information about starting jEdit in background mode.

View>Split Horizontally (shortcut: C+2) splits the View into two TextAreas, placed above each other.

View>Split Vertically (shortcut: C+3) splits the View into two TextAreas, placed next to each other.

Macros>Interface> Splitpane Grow grows the size of the currently focused TextArea.

View>Unsplit Current (shortcut: C+0) removes the split containing the current TextArea only.

View>Unsplit All (shortcut: C+1) removes all splits from the View.

When a View is split, editing commands operate on the TextArea that has keyboard focus. To give a TextArea keyboard focus, click in it with the mouse, or use the following commands.

View>Go to Previous Text Area (shortcut: A+PAGE_UP) shifts keyboard focus to the previous TextArea.

View>Go to Next Text Area (shortcut: A+PAGE_DOWN) shifts keyboard focus to the next TextArea.

## Switching Buffers

Each EditPane has an optional drop-down BufferSwitcher at the top. The BufferSwitcher shows the current buffer and can also be used to switch the current buffer, using menu item commands and their keyboard shortcuts.

View>Go to Previous Buffer (keyboard shortcut: C+PAGE_UP) switches to the previous buffer in the list.

View>Go to Next Buffer (keyboard shortcut: C+PAGE_DOWN) switches to the next buffer in the list.

View>Go to Recent Buffer (keyboard shortcut: C+BACK_QUOTE) flips between the two most recently edited buffers.

View>Show Buffer Switcher (keyboard shortcut: A+BACK_QUOTE) has the same effect as clicking on the buffer switcher combo box.

If you prefer an alternative graphical paradigm for switching buffers, take a look at one of these plugins:

- BufferList

- BufferSelector

- BufferTabs

If you decide to use one of these plugins, you can hide the popup menu buffer switcher in the View pane of the Utilities>Options dialog box.

A number of plugins that implement fast keyboard-based buffer switching are available as well:

- FastOpen

- OpenIt

- SwitchBuffer

## Buffer Sets

The buffer sets feature helps keep the buffer lists local and manageable when using jEdit in a multiple-View and multiple-EditPane environment.

As mentioned in the previous section, each EditPane can show a Buffer Switcher, which displays the contents of a BufferSet. In jEdit 4.2, all EditPane buffer switchers showed the same BufferSet: a global list of all buffers that were opened from any EditPane in any View. When using many Views and EditPanes, this resulted in large lists of buffers, and made the next/previous buffer actions useless with many Views, EditPanes and Buffers.

Since jEdit 4.3, it is possible to have more narrow scopes for the BufferSets of an EditPane. This makes the 'next-buffer' and 'previous-buffer' actions switch between buffers that are local to the view or pane.

The three BufferSet scopes are:

1. Global: Includes all buffers open from any EditPane.

2. View: EditPanes in the same View share the same BufferSet. Opening a buffer in one View will not affect the other views.

3. EditPane: Each EditPane can have its own independent BufferSet.

Bufferset scope can be set from Utilities >Options > View > BufferSet scope:.

File > Close removes the current buffer from the EditPane's BufferSet only. If it was the last BufferSet to contain that buffer, the buffer is also closed.

The File > Close (global) action closes the buffer in all EditPanes, as the jEdit 4.2 File > Close action did before.

When Exclusive Buffersets are enabled, any time a buffer is visited in one EditPane, it should be automatically closed in other EditPanes which use a disjoint (non-intersecting) BufferSet.

Close Others will clear the BufferSet of the current EditPane by performing a Close on all items except those buffers which are displayed in another active EditPane.

#### Switching Bufferset Scopes

The statusbar shows you which BufferSet scope is active (look for the letter "G", "E" or "V"). Double-clicking on that will allow you to change the scope without going into global options. The BufferSet Scope can also be changed from View>Buffer Sets > (Global|View|EditPane) Buffer Set. A change to the bufferset scope affects all editpanes immediately.

#### Sorting of Buffer Sets and Buffer Switchers

Buffer Switchers and Buffer Sets can be sorted independently. Both can be sorted by name or by path. Both can be left unsorted. Possibly the most useful combination is to sort the Buffer Switchers and leave the Buffer Sets unsorted. In this case, it is easy to find the buffer to work with in the Buffer Switcher since the buffer names are sorted alphabetically, and leaving the Buffer Set unsorted means the "go to previous" and "go to next" actions follow the order in which the buffers were last used rather than by name. However, some users prefer Buffer Sets to also be sorted by name or path, so jEdit supports multiple sorting methods.

## Window Docking Layouts

A docking layout is similar to an Eclipse "Perspective" in that it describes a set of dockable windows that are visible to the user at any given time, hiding the rest.

Various jEdit and plugin windows can be docked into the View for convenience. Dockable windows have a popup button in their top-left corner. Clicking this button displays a menu with commands for docking the window in one of four sides of the View.

On each side of the TextArea where there are docked windows, a strip of buttons is shown. There is a button for activating each docked window, as well as a close box and a popup menu button, which when clicked shows a menu for moving or undocking the currently selected window. The popup menu also contains a command for opening a new floating instance of the current window.

The commands in the View>Docking menu move keyboard focus between docking areas.

After you have customized the layout of your dockables and wish to save it for export/import, use the actions View - Docking - Save/Load Docking Layout.

It is possible to configure a Dockable layout for just one or a handful of edit modes. This makes it possible to save or load your dockable layout with the same keyboard shortcut (or automatically) based on the edit mode of your current buffer.

It is also possible to save/load a layout for a particular edit mode. The loading and saving can be done automatically, as configured in the global options docking pane when the mode of the buffer changes, or manually in response to invoking View - Docking - Save/Load Docking Layout for current mode.

Dockable windows can be further configured in the Docking pane of the Utilities>Global Options dialog box. See for details.

For keyboard/power users

Each dockable has three commands associated with it; one is part of the menu bar and opens the dockable. The other two commands are:

- Window Name (Toggle) - opens the dockable window if it is hidden, and hide it if its already open.

- Window Name (New Floating Instance) - opens a new instance of the dockable in a floating window, regardless of the docking configuration. For example, this can be used to view two different directories side-by-side in two file system browser windows.

  A new floating instance can also be opened from the dockable window's popup menu.

These commands cannot be invoked from the menu bar. However, they can be added to the tool bar or context menu, and given keyboard shortcuts; see .

## The Status Bar

The status bar at the bottom of the View consists of the following components, from left to right:

- Caret position information:

  - The offset of the caret from the beginning of the file

  - The line number containing the caret

  - The column position of the caret, with the leftmost column being 1.

    If the line contains tabs, the file position (where a hard tab is counted as one column) is shown first, followed by the screen position (where each tab counts for the number of columns until the next tab stop).

  - The percent offset of the caret from the start of the file. This is based on the line number of the caret and the total number of lines in the file, so this is the same as the relative position of the right scroll bar in the main text area.

  Double-clicking on the caret location indicator displays the Edit>Go to Line dialog box; see .

- A message area where various prompts and status messages are shown.

- The current buffer's edit mode, fold mode, and character encoding. Double-clicking one of these displays the Utilities>Buffer Options dialog box. For more information about these settings, see:

- A set of flags which indicate various editor features and settings. Clicking each flag will toggle the feature in question; hovering the mouse over a flag will show a tool tip with an explanation:

  - Word wrap - see .

  - Multiple selection - see .

  - Rectangular selection - see .

  - Overwrite mode - see .

  - Line separator - see .

  - Buffer Set Scope - see .

- A Task Monitor widget, which spins with activity when a background task is running, and also lists how many tasks are running. Clicking on this will open the Task Monitor dockable ().

- A Java heap memory usage indicator, that shows used and total heap memory, in megabytes. Double-clicking this indicator opens the Utilities>Troubleshooting>Memory Status dialog box.

The order and visibility of each of the above items can be controlled in the Status Bar pane of the Utilities>Options dialog box; see .

## The Action Bar

The action bar allows almost any editor feature to be accessed from the keyboard.

Utilities>Action Bar (shortcut: C+ENTER) displays the action bar at the bottom of the View and gives it keyboard focus. The action bar remembers previously entered strings; see for details.

To use the action bar, input a command and press Enter. The following commands are supported:

#### Action invocations

Each menu item and tool bar button is bound to an action. To find out the name of an action, invoke the menu item or click the tool bar button, and look in the action bar's history.

If a substring or an action name is entered, pressing Tab shows a popup listing matching actions. An action can be selected using the Up and Down arrow keys, or by entering more characters of its name.

Pressing Enter with an incomplete substring invokes the action that would be first in the completion popup's list.

For example, entering `d-o` will invoke `combined-options`, which has the same effect as invoking Utilities> Options.

#### Buffer-local properties

Entering `buffer.property=value` sets the value of the buffer-local property named `property` to `value`. Buffer-local properties are documented in .

For example, entering `buffer.tabSize=4` changes the current buffer's tab size to 4.

See for information about buffer-local properties.

#### Global properties

Entering `property=value` sets the value of the global property named `property` to `value`. This feature is primarily intended to help plugin developers, since the properties jEdit uses to store its settings are not currently documented.

#### Command repetition

To repeat a command multiple times, enter a number in the action bar, then press the key-combination that invokes the command. For example, C+ENTER 1 4 C+d will delete 14 lines; C+ENTER 9 # will insert ######### in the buffer. Note: The space characters in these examples should not be typed; they are only here to visually separate the keys to be typed.

If you specify a repeat count greater than 20, a confirmation dialog box will be displayed, asking if you really want to perform the action. This prevents you from hanging jEdit by executing a command too many times.