Usage Questions
Prev |  | Next

## Usage Questions

This section deals general usage of jEdit, including customisation.

1. Abbreviations
  Q: How can I create abbreviations “on the fly” as I type?
  Q: How can I have abbreviations expanded automatically as I type?
2. Clipboard features
  Q: Can I copy selections from more than one location in a document (or more than one document) and paste the aggregate text in one operation?
3. File Attributes
  Q: Does jEdit preserve file ownership and permissions when it saves files?
  Q: Why does jEdit ignore my choice for line separator characters when I save a file?
  Q: Can jEdit auto-detect character encodings when it opens a file?
  Q: I'm using the iso-8859-1 character encoding. How do I type and save the Euro sign (“€”)?
4. File Management
  Q: How can I open files in jEdit using drag and drop?
  Q: How do I add and remove directories to the list of “favorites” in jEdit's File System Browser?
  Q: How do I associate particular file types with jEdit so I can open them by double clicking their icons in Windows Explorer?
  Q: Can I restrict jEdit to opening and saving files in a single directory without changing file permissions?
  Q: On Windows, how can I change the name of my file from myfile.txt to MyFile.txt?
5. Formatting text
  Q: How do I indent or unindent selections of text?
  Q: Is there a way to automatically view line numbers when a buffer is opened?
  Q: Does jEdit know smart quotes? In .tex files I would like to use `` or '' instead of ".
  Q: Does jEdit have a “soft” wrap text mode?
  Q: The display of spaces as a character in the editor is annoying. How can I disable those small square boxes?
  Q: Does jEdit support i18n?
6. Compiling source code
  Q: How do I compile my Java source in JEdit?
  Q: How do I create a new edit mode?
  Q: Does jEdit support DocBook tags?
7. Tips for Emacs users
  Q: Can I have an emacs style tab key (tab anywhere in a line re-indents it)?
  Q: How do I map Ctrl-E to go to the end of the line?
  Q: What about ctrl-K?
8. Other Settings and Options
  Q: How can I change the font used for menu labels and other elements of jEdit's user interface?
  Q: I want to add a directory to the classpath. I did this in the standalone BeanShell with ease by using the addClassPath(String) method. but this doesn't work in a macro. How could I manage the classpath in jEdit?
  Q: Are there any hidden features?

#### 1. Abbreviations
Q: How can I create abbreviations “on the fly” as I type? Q: How can I have abbreviations expanded automatically as I type?
Q: | How can I create abbreviations “on the fly” as I type?
A: | Type the form of abbreviation you wish to use, then without pressing the `SPACE` key, press `CTRL`+`;`. A dialog will appear for entering text that goes before and after the editing caret. For example, you can insert an opening HTML or XML tag before the cursor and its corresponding closing tag after the cursor. Use the mouse to select Add global or Add mode-specific. The first choice makes the abbreviation available for all documents; the second makes it available only in documents with the same editing mode as the current document. In this way, you can add abbreviations that operate only a particular class of documents, for example, Java source files or XML markup. Either way, the abbreviation will be stored for future use.
Q: | How can I have abbreviations expanded automatically as I type?
A: | Select Utilities>Global Options, then select the Abbreviations option pane. You will see a checkbox option for “Space bar expands abbrevs”. Here you can also add, modify and delete abbreviations on a global basis or for individual editing modes.
#### 2. Clipboard features
Q: Can I copy selections from more than one location in a document (or more than one document) and paste the aggregate text in one operation?
Q: | Can I copy selections from more than one location in a document (or more than one document) and paste the aggregate text in one operation?
A: | The Cut Append (`CTRL`+`E` `CTRL`+`U`) and Copy Append (`CTRL`+`E` `CTRL`+`A`) both add the selected text to the existing contents of the Clipboard. A single Paste (`CTRL`+`V`) command will insert the aggregated text at the cursor or in place of an existing selection.
#### 3. File Attributes
Q: Does jEdit preserve file ownership and permissions when it saves files? Q: Why does jEdit ignore my choice for line separator characters when I save a file? Q: Can jEdit auto-detect character encodings when it opens a file? Q: I'm using the iso-8859-1 character encoding. How do I type and save the Euro sign (“€”)?
Q: | Does jEdit preserve file ownership and permissions when it saves files?
A: | One reason this can be an issue is that by default, jEdit adopts the conservative approach of saving a file to a temporary name before renaming that file to the desired name. This procedure minimizes the risk of crashes causing loss of data, and works without reported problems on local file systems. However, when files are served remotely by FTP, Samba or other means, it may not be possible to preserve file attributes on the server because the newly created temporary file's owner may differ from the owner of the original file on the server. To avoid this problem, you can disable the two-step file saving routine. Select Utilities>Global Options, then under Loading & Saving, clear the checkbox for Two-stage save.
Q: | Why does jEdit ignore my choice for line separator characters when I save a file?
A: | When jEdit saves an existing file, it uses the line separator already used by the file. The line separator designated in the buffer options or elsewhere is used only for new files.
Q: | Can jEdit auto-detect character encodings when it opens a file?
A: | Only Unicode can be detected when a file is loaded. For other encodings, you must specify the encoding when the file is loaded if you do not wish to use the default encoding for your operating system. There are a few features that can help you navigate through encoding issues. You can select the encoding you wish to use from Encoding in the Commands menu of the File System Browser. You can also designate a default encoding in the Loading & Saving pane of the Global Options dialog; if you do not, jEdit adopts your operating system's default encoding as its own default. You can change the encoding used to save an individual file by selecting Utilities>Buffer Options and changing the current buffer's properties. Finally, jEdit keeps track of the encodings used in the files named in the File>Recent Files drop-down list. These features allow you to minimize the attention given to character encodings, but you must still pay some attention if you do not want to use default settings.
Q: | I'm using the iso-8859-1 character encoding. How do I type and save the Euro sign (“€”)?
A: | You need to use instead the iso-8859-15 character set, which is a modification of iso-8859-1 that includes the Euro sign and some Finnish and French characters. The Euro sign represents character value 0xA4 in this 8-bit set. To open a file manually using this encoding, select File>Open... , and select ISO8859_15 from Commands>Enconding before opening the file. There is a startup script in the “Downloads” area of jEdit Community named `euro.bsh` that can be used as a startup script to help simplify the insertion of the Euro symbol if your keyboard currently lacks a dedicated key.
#### 4. File Management
Q: How can I open files in jEdit using drag and drop? Q: How do I add and remove directories to the list of “favorites” in jEdit's File System Browser? Q: How do I associate particular file types with jEdit so I can open them by double clicking their icons in Windows Explorer? Q: Can I restrict jEdit to opening and saving files in a single directory without changing file permissions? Q: On Windows, how can I change the name of my file from myfile.txt to MyFile.txt?
Q: | How can I open files in jEdit using drag and drop?
A: | Try installing the Drag and Drop plugin using the Plugin Manager feature. It works with most (but not all) combinations of operating systems and current Java runtime environments.
Q: | How do I add and remove directories to the list of “favorites” in jEdit's File System Browser?
A: | To add a directory to the list of favorites, navigate so that the directory is at the top of the tree displayed in the File System Browser window, click the Favorites button, and select Add to favorites from the resulting menu. To delete a directory from the favorites list, use the same menu to go to the favorites list. Right-click on the directory to be deleted and select Delete. This operation will delete the directory from the list of favorites but will have no effect on the directory itself.
Q: | How do I associate particular file types with jEdit so I can open them by double clicking their icons in Windows Explorer?
A: | You associate the file extension with ``<jEdit installation directory>`\jedit.bat`. This can be done from the File Types tab in the Windows Explorer's Tools -> Folder options... menu. The EXE-installer for Windows includes a custom context menu handler. It will provide menu items for using jEdit any time you right-click on a file icon in Windows Explorer. This feature does not interfere with any existing file associations.
Q: | Can I restrict jEdit to opening and saving files in a single directory without changing file permissions?
A: | The easiest way to get this kind of behavior is to use macros that open the Virtual File Browser to a specific, fixed directory, and then change the default keyboard shortcuts for opening and saving files to run these macros.
Q: | On Windows, how can I change the name of my file from `myfile.txt` to `MyFile.txt`?
A: | The Windows native file system deals with file names in a case-insensitive manner, so `myfile.txt` and `MyFile.txt` refer to the same file. As a result, the jEdit file browser treats both spellings identically and does not make a name change. Using our example, the easiest workaround is to rename the file in two steps: first to `_myfile.txt`, then to `MyFile.txt`.
#### 5. Formatting text
Q: How do I indent or unindent selections of text? Q: Is there a way to automatically view line numbers when a buffer is opened? Q: Does jEdit know smart quotes? In .tex files I would like to use `` or '' instead of ". Q: Does jEdit have a “soft” wrap text mode? Q: The display of spaces as a character in the editor is annoying. How can I disable those small square boxes? Q: Does jEdit support i18n?
Q: | How do I indent or unindent selections of text?
A: | Using jEdit's default configuration, you can indent a selection of text by pressing `ALT`+`RIGHT`. Unindent a selection by pressing `ALT`+`LEFT`.
Q: | Is there a way to automatically view line numbers when a buffer is opened?
A: | Select Utilities>Global Options, and in the Gutter option pane select the Line Numbering check box.
Q: | Does jEdit know smart quotes? In .tex files I would like to use ```` or `''` instead of `"`.
A: | While jEdit can display any character provided by a supported encoding set and enter any character supported by a keyboard driver, it does not have the ability to insert “smart quote” pairs automatically as some word processors do. This would require a BeanShell macro to modify quoted text. The Accents and CharacterMap plugins can also help you type international characters. You also have the option of using a TeX macro (or, in LaTeX, a pair of environment tags) to have the standard double quotation mark `"` transformed into the appropriate opening or closing smart quotes without the need to keep track of when quoted text opens or closes.
Q: | Does jEdit have a “soft” wrap text mode?
A: | jEdit's 4.3's soft wrap mode, and especially its wrap to margin=0, is one of its many features that just works better than it does in most other editing environments. Soft Wrap with margin=0 was unavailable in jEdit 4.2, but users of 4.1 will remember it well. When you set SOFT WRAP with a margin=0, you don't need to use the horizontal scroller anymore. It's just as simple as that. jEdit wrap capability can be activated for a specific buffer, specific editing modes, or for all documents by default. In prior versions, both the text wrap feature and the Edit>Text>Format Paragraph command insert “hard” end of line characters. This “hard wrap” feature remains available as an option for buffers and editing modes.
Q: | The display of spaces as a character in the editor is annoying. How can I disable those small square boxes?
A: | This is controlled by the WhiteSpace plugin. To change your settings to disable display of whitespace characters, select Utilities>Global Options, then select Plugin options>WhiteSpace. You can separately configure the display of spaces, tabs, and other whitespace characters.
Q: | Does jEdit support i18n?
A: | When editing text documents, jEdit supports any available encoding scheme, and can open files with a specified encoding other than the default encoding of your operating system using the Commands>Encoding from the File System Browser. With respect to menu labels, message strings and other GUI elements, the jEdit project team currently does not have the resources to maintain multiple property sets in languages other than English, particularly since the development effort is continuing at a rapid pace. There has not been great demand for this in any event. This may be because jEdit is primarily a tool for programmers, and the use of English as a common first or second language is widespread in the global programming community. This decision may be reconsidered when the application has further matured and if more individuals express a willingness to be involved in translation work.
#### 6. Compiling source code
Q: How do I compile my Java source in JEdit? Q: How do I create a new edit mode? Q: Does jEdit support DocBook tags?
Q: | How do I compile my Java source in JEdit?
A: | There are a number of plugins that you can use to compile Java source code. You can run a Java compiler on the command line in the “System” shell of the Console plugin. If you are using the JCompiler plugin, you will have a “JCompiler” shell in the Console plugin, and you can run the `compile` command for the current file, or the `compilepkg` command on all of the current directory's source code files. You can also use the “Ant” commandos from the Console plugin or the AntFarm plugin to run complex builds on a project of source code files, using a `build.xml` file to specify build commands and dependencies.
Q: | How do I create a new edit mode?
A: | Take a look at the “Writing Edit Modes” section of the User's Guide. Basically, you have to write an XML file containing data on the mode's file extensions and buffer and syntax highlighting properties, then add information about the new mode file to a second XML file containing a catalog of modes.
Q: | Does jEdit support DocBook tags?
A: | The application contains editing modes for both SGML and XML. Using jEdit abbreviations, you can quickly insert commonly-typed tags with a couple of keystroke. There are a number of abbreviations in the XML and SGML modes that create pairs of DocBook tags on the fly. You can get validation, tree-browsing, auto-complete, and auto-closing tags with the XML plugin, a very advanced XML editing tool. With whe XInsert or Template plugin you can create multi-layered DocBook elements. There are other macros targeting DocBook available from the jEdit Community web site that you can use or adapt for your own purposes.
#### 7. Tips for Emacs users
Q: Can I have an emacs style tab key (tab anywhere in a line re-indents it)? Q: How do I map Ctrl-E to go to the end of the line? Q: What about ctrl-K?
For more emacs help, check out this site for more emacs macros.
Q: | Can I have an emacs style tab key (tab anywhere in a line re-indents it)?
A: | Yes. You can do this by rebinding the tab key to Indent Selected Lines in the Global Options.
Q: | How do I map Ctrl-E to go to the end of the line?
A: | jEdit has it set up as a 2-key shortcut. In order to make Ctrl-E a one-key shortcut again, you first have to redefine all of the Ctrl-E prefix shortcuts to mean something else. `jedit_keys.props` shows you all of the current keyboard bindings. As you can see, Ctrl-e is used for many things in jEdit. If you want to redefine it to be a single-key shortcut, first thing you need to do is decide on another Ctrl-key to use as a prefix, to redefine jEdit's fold features. I recommend using Ctrl-Q as the prefix, and if you want to use Ctrl-Q to quit, you have to hit Ctrl-Q twice. Cut and paste the below shortcuts into your own properties file.
    # emacs end of line
    end.shortcut2=C+e
    # Ctrl-Q twice to quit
    exit.shortcut=C+q C+q
    # C+q is our new C+e prefix
    #{{{ C+q C+X

    # Unused: f, h, q, y
    copy-append.shortcut=C+q C+a
    search-in-open-buffers.shortcut=C+q C+b
    range-comment.shortcut=C+q C+c
    search-in-directory.shortcut=C+q C+d
    replace-and-find-next.shortcut=C+q C+g
    ignore-case.shortcut=C+q C+i
    scroll-to-current-line.shortcut=C+q C+j
    line-comment.shortcut=C+q C+k
    select-line-range.shortcut=C+q C+l
    add-marker.shortcut=C+q C+m
    center-caret.shortcut=C+q C+n
    open-path.shortcut=C+q C+o
    vertical-paste.shortcut=C+q C+p
    replace-in-selection.shortcut=C+q C+r
    save-all.shortcut=C+q C+s
    toggle-line-numbers.shortcut=C+q C+t
    cut-append.shortcut=C+q C+u
    paste-previous.shortcut=C+q C+v
    close-all.shortcut=C+q C+w
    regexp.shortcut=C+q C+x
    paste-deleted.shortcut=C+q C+y
    redo.shortcut=C+q C+z
    #}}}

    #{{{ C+q C+non-alpha
    left-docking-area.shortcut=C+q C+LEFT
    top-docking-area.shortcut=C+q C+UP
    right-docking-area.shortcut=C+q C+RIGHT
    bottom-docking-area.shortcut=C+q C+DOWN

    prev-marker.shortcut=C+q C+COMMA
    next-marker.shortcut=C+q C+PERIOD
    prev-bracket.shortcut=C+q C+OPEN_BRACKET
    next-bracket.shortcut=C+q C+CLOSE_BRACKET
    close-docking-area.shortcut=C+q C+BACK_QUOTE
    #}}}

    #{{{ C+q X
    # Unused: b e g h j k m o q t y z
    add-explicit-fold.shortcut=C+q a
    collapse-all-folds.shortcut=C+q c
    delete-paragraph.shortcut=C+q d
    format-paragraph.shortcut=C+q f
    find-previous.shortcut=C+q g
    invert-selection.shortcut=C+q i
    select-line.shortcut=C+q l
    narrow-to-fold.shortcut=C+q n n
    narrow-to-selection.shortcut=C+q n s
    select-paragraph.shortcut=C+q p
    remove-trailing-ws.shortcut=C+q r
    select-fold.shortcut=C+q s
    insert-literal.shortcut=C+q v
    select-word.shortcut=C+q w
    parent-fold.shortcut=C+q u
    expand-all-folds.shortcut=C+q x
    #}}}
Q: | What about ctrl-K?
A: | Check out `macros/Emacs_Ctrl_K.bsh`. Bind it to Ctrl-k from the shortcuts option pane.
#### 8. Other Settings and Options
Q: How can I change the font used for menu labels and other elements of jEdit's user interface? Q: I want to add a directory to the classpath. I did this in the standalone BeanShell with ease by using the addClassPath(String) method. but this doesn't work in a macro. How could I manage the classpath in jEdit? Q: Are there any hidden features?
Q: | How can I change the font used for menu labels and other elements of jEdit's user interface?
A: | Select Utilities>Global Options, then the Appearance option pane. When you select the “Metal” look and feel you can also select the fonts used for various displayed items.
Q: | I want to add a directory to the classpath. I did this in the standalone BeanShell with ease by using the `addClassPath(String)` method. but this doesn't work in a macro. How could I manage the classpath in jEdit?
A: | The implementation of BeanShell used in jEdit does not use BeanShell's class loader. The script method contained in loadJarClasses.bsh (found in the Downloads section of jEdit Community) should work if you know the path to a specific class file or class archive.
Q: | Are there any hidden features?
A: | Yes. You can access them by binding a shortcut to the action in question. You will find a complete list of available commands under the Shortcuts area in the Global Options.

Prev |  | Next
Installation Questions | Home | Macros