An edit mode specifies syntax highlighting rules, auto indent behavior, and various other customizations for editing a certain file type. This section only covers using existing edit modes; information about writing your own can be found in Part II.
When a file is opened, jEdit first checks the file name against a list of known patterns. For example, files whose names end with “.c” are opened with C mode, and files named Makefile are opened with Makefile mode. If a suitable match based on file name cannot be found, jEdit checks the first line of the file. For example, files whose first line is “#!/bin/sh” are opened with shell script mode.
File name and first line globs can be changed in the Editing pane of the Utilities>Global Options dialog box. See Appendix D for information about glob patterns.
The edit mode can be specified manually as well. The current buffer's edit mode can be set on a one-time basis in the Utilities>Buffer Options dialog box; see the section called “The Buffer Options Dialog Box”. To set a buffer's edit mode for future editing sessions, place the following in one of the first or last 10 lines of the buffer, where edit mode is the name of the desired edit mode:
:mode=edit mode: |
A list of edit modes can be found in the Utilities>Buffer Options dialog box.
Syntax highlighting is the display of programming language tokens using different fonts and colors. This makes code easier to follow and errors such as misplaced quotes easier to spot. All edit modes except for the plain text mode perform some kind of syntax highlighting.
The colors and styles used to highlight syntax tokens can be changed in the Syntax Highlighting pane of the Utilities>Global Options dialog box; see the section called “The Global Options Dialog Box”.