# Customizing jEdit

## The Buffer Options Dialog Box

Utilities>Buffer Options displays a dialog box for changing editor settings on a per-buffer basis. Changes made in this dialog box are not retained after the buffer is closed.

The following settings can be changed here:

- The line separator (see )

- The character encoding (see )

- If the file should be GZipped on disk (see )

- The edit mode (see )

- The fold mode (see )

- The wrap mode and margin (see )

- The tab width (see )

- The indent width

- If soft tabs should be used (see )

## Buffer-Local Properties

Buffer-local properties provide an alternate way to change editor settings on a per-buffer basis. While changes made in the Buffer Options dialog box are lost after the buffer is closed, buffer-local properties take effect each time the file is opened, because they are embedded in the file itself.

When jEdit loads a file, it checks the first and last 10 lines for colon-enclosed name/value pairs. For example, placing the following in a buffer changes the indent width to 4 characters, enables soft tabs, and activates the Perl edit mode:

    :indentSize=4:noTabs=true:mode=perl:

Adding buffer-local properties to a buffer takes effect after the next time the buffer is saved.

The following table describes each buffer-local property in detail.

Property name | Description
--- | ---
`collapseFolds` | Folds with a level of this or higher will be collapsed when the buffer is opened. If set to zero, all folds will be expanded initially. See .
`deepIndent` | When set to true, multiple-line expressions delimited by parentheses are aligned like so:
    retVal.x = (int)(horizontalOffset
        + Chunk.offsetToX(info.chunks,
                          offset));
With this setting disabled, the text would look like so:
    retVal.x = (int)(horizontalOffset
        + Chunk.offsetToX(info.chunks,
        offset));
`folding` | The fold mode; one of none, indent, explicit, or the name of a plugin folding mode. See .
`indentSize` | The width, in characters, of one indent. Must be an integer greater than 0. See .
`maxLineLen` | The maximum line length and wrap column position. Inserting text beyond this column will automatically insert a line break at the appropriate position. See .
`mode` | The default edit mode for the buffer. See .
`noTabs` | If set to true, soft tabs (multiple space characters) will be used instead of real tabs. See .
`noWordSep` | A list of non-alphanumeric characters that are not to be treated as word separators. Global default is _.
`tabSize` | The tab width. Must be an integer greater than 0. See .
`wordBreakChars` | Characters, in addition to spaces and tabs, at which lines may be split when word wrapping. See .
`wrap` | The word wrap mode; one of none, soft, or hard. See .

## The Global Options Dialog Box

Utilities>Global Options displays the global options dialog box. The dialog box is divided into several panes, each pane containing a set of related options. Use the list on the left of the dialog box to switch between panes. Only panes created by jEdit are described here; some plugins add their own option panes, and information about them can be found in the documentation for the plugins in question.

### The General Pane

The General pane contains various settings, such as the default line separator, the number of recent files to remember, if the buffer list should be sorted, and so on.

### The Abbreviations Pane

The Abbreviations option pane can be used to enable or disable automatic abbreviation expansion, and to edit currently defined abbreviations.

The combo box labelled Abbrev set selects the abbreviation set to edit. The first entry, global, contains abbreviations available in all edit modes. The subsequent entries correspond to each mode's local set of abbreviations.

To change an abbreviation or its expansion, either double-click the appropriate table entry, or click a table entry and then click the Edit button. This will display a dialog box for modifying the abbreviation.

The Add button displays a dialog box where you can define a new abbreviation. The Remove button removes the currently selected abbreviation from the list.

See for information about positional parameters in abbreviations.

Abbreviations creating and editing

### The Appearance Pane

The Appearance pane can be used to change the appearance of user interface controls such as buttons, labels and menus. It can also be used to change the docking framework (the dockable window manager). The number of items retained in history text fields can also be set here; see .

Note that changes to certain settings such as the Swing look and feel and the docking framework require a restart of jEdit to take effect.

### The Autosave and Backup Pane

The Autosave option pane contains settings for the autosave and backup features. See and .

### The Context Menu Pane

The Context Menu option pane edits the text area's right-click context menu. See .

### The Docking Pane

The Docking option pane specifies docking location for various dockable windows. Another way to specify docking locations is to use the popup menus associated with each dockable window; see .

### The Editing Pane

The Editing option pane contains settings such as the tab size, syntax highlighting and soft tabs on a global or mode-specific basis.

Changing options from this optionpane does not change XML mode definition files on disk; it merely writes values to the user properties file which override those set in mode files. To find out how to edit mode files directly, see . Some of these options can be further overridden on an individual file basis through the use of buffer-local properties.

The `File name glob` and `First line glob` text fields let you specify a glob pattern that names and first lines of buffers will be matched against to determine the edit mode. See for information about glob patterns.

The `Extra Word Characters` allows you to set the `noLineSep` buffer property on a mode-wide basis, allowing you to define what is considered part of a word when double-clicking on it in the text area.

The `Deep Indent` option instructs jEdit to indent subsequent lines so that they line up with the open bracket on the previous line.

### The Encodings Pane

This option pane is new to jEdit 4.3, and offers international users of jEdit many flexible options for defining how Encodings are handled in jEdit. See for the basics.

In previous versions of jEdit, there was very little encoding autodetection, so use autodetection when possible is an option you can switch on or off.

The `List of Encoding Autodetector Names` is an experimental feature that allows for jEdit and plugins to offer additional encoding autodetector routines. At the moment, there are two techniques known by jEdit: the `BOM` (Byte Order Mark), and the `XML-PI` (XML processing instruction) techniques. Others can be defined as services and added to this space-separated list. See EncodingDetector for details on how to offer this service. The order they appear in this list determines the order of detectors that are tried on each file.

The `List of Fallback Encodings` is used when a file fails to open in the default encoding, and the Encoding Autodetectors also fail. The list order here determines the order of encodings that are tried. Each is separated by a space. This is especially handy when doing directory searches through files of different encodings. We suggest using `UTF-8` as either your default or one of the fallback encodings.

While jEdit allows you to edit files in a variety of different encodings, the average user switches between only 2 or 3. In other parts of jEdit, where the list of encodings is displayed in a combobox (such as the buffer options) or a menu (such as File - Reload with Encoding submenu) it may be desirable to display only a subset of available encodings, those that are in common local use. The Encodings checkbox list allows the user to select the subset of supported encodings to display in other GUI components that list all of the encodings.

### The Gutter Pane

The Gutter option pane contains settings to customize the appearance of the gutter. Some new options were added to jEdit 4.3, including "show gutter", "minimal number of digits to reserve for line numbers", and "fold style". See .

### The Mouse Pane

The Mouse option pane contains settings for toggling drag and drop of text, as well as gutter mouse click behavior.

The only option that may not be self-explanatory is the Double-Click drag joins non-alphanumeric characters. This option means that double-click will select a region that includes the non-alphabetical characters, as defined for the current mode. The actual set of characters can be defined for an indiviual file via buffer-local properties (`noWordSep`) or on a mode-wide basis from the Editing option pane (`Extra Word Characters`).

### The Printing Pane

The Printing option pane contains settings to control the appearance of printed output. Workarounds that might be needed for your Java version to print correctly can also be enabled here. See .

### The Plugin Manager Pane

The Plugin Manager pane contains a chooser for the desired download mirror, as well as various settings such as the directory where plugins are to be installed. In addition, you can set the time in minutes that the pluginlist can be cached from jedit.org, helping to reduce the server load. See .

### The Proxy Servers Pane

The Proxy Servers option pane lets you specify HTTP and SOCKS proxy servers to use when jEdit makes network connections, for example when downloading plugins.

### The Shortcuts Pane

The Shortcuts option pane associates keyboard shortcuts with commands. Each command can have up to two shortcuts associated with it.

The combo box at the top of the option pane selects the command set to edit. Command sets include the set of all built-in commands, the commands of each plugin, and the set of macros.

To change a shortcut, click the appropriate table entry and press the keys you want associated with that command in the resulting dialog box. The dialog box will warn you if the shortcut is already assigned.

#### 2-key shortcut prefixes

Some shortcuts, such as C+e, C+m, and C+r, are prefixes for two-keystroke shortcuts. Another keystroke may be used as a prefix in a 2-key shortcut, so for example, C+x can be redefined as a prefix to make it more emacs-like, by mapping any other action to a C+x prefixed shortcut.

Conversely, emacs users will notice at first that C+e can not be mapped as a single key shortcut to go to the end of the line, unless all of the other actions that contain C+e prefixed shortcuts are remapped to other shortcuts first. After that, C+e can be bound to end-of-line.

The default shortcuts can be found in `jedit_keys.props`.

### The Status Bar Pane

The Status Bar option pane contains settings to customize the status bar, or disable it completely. See .

### The Syntax Highlighting Pane

The Syntax Highlighting pane can be used to customize the fonts and colors for syntax highlighting. See .

### The Text Area Pane

The Text Area pane contains settings to customize the appearance of the text area. See .

### The Tool Bar Pane

The Tool Bar option pane lets you edit the tool bar, or disable it completely. See .

### The View Pane

The View option pane lets you change various settings related to the editor window's appearance, including the arrangement of dockable windows, and if the search bar and buffer switcher should be visible. See .

### The File System Browser Panes

The File System Browser group contains two option panes, General and Colors. The former contains various file system browser settings. The latter configures glob patterns used for coloring the file list. See for more information.

## The jEdit Settings Directory

jEdit stores settings, macros, and plugins as files inside the settings directory. In most cases, editing these files by hand is not necessary, since graphical tools and editor commands can do the job. However, being familiar with the structure of the settings directory still comes in handy in certain situations, for example when you want to copy jEdit settings between computers.

The location of the settings directory is system-specific; it is printed to the activity log (Utilities>Troubleshooting>Activity Log). For example:

    [message] jEdit: Settings directory is /home/slava/.jedit

Specifying the `-settings` switch on the command line instructs jEdit to store settings in a directory other than the default. For example, the following command will instruct jEdit to store all settings in the `jedit` subdirectory of the `C:` drive:

    C:\jedit> jedit -settings=C:\jedit

The `-nosettings` switch will force jEdit to not look for or create a settings directory; default settings will be used instead.

jEdit creates the following files and directories inside the settings directory; plugins may add more:

- `abbrevs` - a plain text file which stores all defined abbreviations. See .

- `activity.log` - a plain text file which contains the full activity log. See .

- `history` - a plain text file which stores history lists, used by history text fields and the Edit>Paste Previous command. See and .

- `jars` - this directory contains plugins. See .

- `jars-cache` - this directory contains plugin cache files which decrease the time to start jEdit. They are automatically updated when plugins are installed or updated.

- `killring.xml` - stores recently deleted text. See .

- `macros` - this directory contains macros. See .

- `modes` - this directory contains custom edit modes. See .

- `perspective.xml` - an XML file that stores the list of open buffers and views used to maintain editor state between sessions.

- `PluginManager.download` - this directory is usually empty. It only contains files while the plugin manager is downloading a plugin. For information about the plugin manager, see .

- `pluginMgr-Cached.xml.gz` - this contains a cached copy of the last XML plugin list downloaded from plugin central. If you delete this file, a new one will be created next time you try to install a plugin via Plugin Manager.

- `printspec` - a binary file that stores printing settings when running under Java 2 version 1.4.

- `properties` - a plain text file that stores the majority of jEdit's and its plugins settings. For more information see .

- `recent.xml` - an XML file which stores the list of recently opened files. jEdit remembers the caret position and character encoding of each recent file, and automatically restores those values when one of the files is opened.

- `registers.xml` - an XML file that stores register contents. See for more information about registers.

- `server` - a plain text file that only exists while jEdit is running. The edit server's port number and authorization key is stored here. See .

- `settings-backup` - this directory contains numbered backups of all automatically-written settings files.

### The jEdit properties file

The jEdit `properties` file uses the Java properties syntax to store key/value pairs. All of the values are stored as strings, but are interpreted as other types (such as integer or boolean) by plugins at runtime.

Editing and saving this file while jEdit is running means that until you restart jEdit again, all other changed settings will be lost.