NEdit.org    The Nirvana Editor Web Site
.

NEdit.org Home
Table of Contents

Getting Started

Basic Operation
Selecting Text
Finding/Replacing
Cut and Paste
Using the Mouse
Keyboard Shortcuts
Shifting and Filling
File Format

Features for
Programming

Programming
Tabs/Emul. Tabs
Auto/Smart Indent
Syntax Highlighting
Finding Decl.

Regular Expressions
Basic Syntax
Escape Sequences
Parenthetical Const.
Advanced Topics
Examples

Macro/Shell Extensions
Shell and Filters
Learn/Replay
Macro Language
Macro Subroutines
Action Routines

Customizing
Customizing NEdit
Preferences
X Resources
Key Binding
Highlighting Patterns
Indent Macros

Miscellaneous
NEdit Cmd Line
Client/Server Mode
Crash Recovery
Problems/Defects

.

 

.

Preferences

The Preferences menu allows you to set options for both the current editing window, and default values for newly created windows and future NEdit sessions. Options in the Preferences menu itself (not in the Default Settings sub-menu) take effect immediately and refer to the current window only. Options in the Default Settings sub-menu have no effect on the current window, but instead provide initial settings for future windows created using the New or Open commands. Preferences set in the Default Settings sub-menu can also be saved in a file that is automatically read by NEdit at startup time, by selecting Save Defaults.

*  Preferences Menu

  • Default Settings
    Menu of initial settings for future windows. Generally the same as the options in the main part of the menu, but apply as defaults for future windows created during this NEdit session. These settings can be saved using the Save Defaults command below, to be loaded automatically each time NEdit is started.
  • Save Defaults
    Save the default options as set under Default Settings for future NEdit sessions.
  • Statistics Line
    Show the full file name, line number, and length of the file being edited.
  • Incremental Search Line
    Keep the incremental search bar (Search -> Find Incremental) permanently displayed at the top of the window.
  • Show Line Numbers
    Display line numbers to the right of the text.
  • Language Mode
    Tells NEdit what language (if any) to assume, for selecting language-specific features such as highlight patterns and smart indent macros, and setting language specific preferences like word delimiters, tab emulation, and auto-indent. See Features for programming for more information.
  • Auto Indent
    Setting Auto Indent "on" maintains a running indent (pressing the return key will line up the cursor with the indent level of the previous line). If smart indent macros are available for the current language mode, smart indent can be selected and NEdit will attempt to guess proper language indentation for each new line. See Automatic Indent for more information.
  • Wrap
    Choose between two styles of automatic wrapping or none.
    • Auto Newline wrap, wraps text at word boundaries when the cursor reaches the right margin, by replacing the space or tab at the last word boundary with a newline character.
    • Continuous Wrap wraps long lines which extend past the right margin. Continuous Wrap mode is typically used to produce files where newlines are ommitted within paragraphs, to make text filling automatic (a kind of poor-man's word processor). Text of this style is common on Macs and PCs but is not necessarily supported very well under Unix (except in programs which deal with e-mail, for which it is often the format of choice).
  • Wrap Margin
    Set margin for Auto Newline Wrap, Continuous Wrap, and Fill Paragraph. Lines may, be wrapped at the right margin of the window, or the margin can be set at a specific column.
  • Tabs
    Set the tab distance (number of characters between tab stops) for tab characters, and control tab emulation and use of tab characters in padding and emulated tabs.
  • Text Font...
    Change the font(s) used to display text (fonts for menus and dialogs must be set using X resources for the text area of the window). See below for more information.
  • Highlight Syntax
    If NEdit recognizes the language being edited, and highlighting patterns are available for that language, use fonts and colors to enhance viewing of the file. See "Syntax highlighting" section for more information.
  • Make Backup Copy
    On Save, write a backup copy of the file as it existed before the Save command with the extension .bck (Unix only).
  • Incremental Backup
    Periodically make a backup copy of the file being edited under the name ~filename on Unix or _filename on VMS (see Crash Recovery section).
  • Show Matching (..)
    Momentarily highlight matching parenthesis, brackets, and braces when one of these characters is typed, or when the insertion cursor is positioned after it.
  • Overtype
    In overtype mode, new characters entered replace the characters in front of the insertion cursor, rather than being inserted before them.
  • Read Only
    Lock the file against accidental modification. This temporarily prevents the file from being modified in this NEdit session. Note that this is diferent from setting the file protection.

* Preferences -> Default Settings Menu

Options in the Preferences -> Default Settings menu have the same meaning as those in the top-level Preferences menu, except that they apply to future NEdit windows and future NEdit sessions if saved with the Save Defaults command. Additional options which appear in this menu are:

  • Language Modes
    Define language recognition information (for determining language mode from file name or content) and set language specific preferences.
  • Tag Collisions
    How to react to multiple tags for the same name. Tags are described in the section Finding Declarations (ctags). In Show All mode, all matching tags are displayed in a dialog. In Smart mode, if one of the matching tags is in the current window, that tag is chosen, without displaying the dialog.
  • Customize Menus
    Add/remove items from the Shell, Macro, and window background menus (see below).
  • Searching
    Options for controlling the behavior of Find and Replace commands:
    • Verbose
      Presents search results in dialog form, asks before wrapping a search back around the beginning (or end) of the file.
    • Keep Dialogs Up
      Don't pop down Replace and Find boxes after searching.
    • Default Search Style
      Initial setting for search type in Find and Replace dialogs.
  • Syntax Highlighting
    Program and configure enhanced text display for new or supported languages (See Syntax Highlighting and Writing Syntax Highlighting Patterns sections).
  • Sort Open Prev. Menu
    Option to order the File -> Open Previous menu alphabetically, versus in order of last access.
  • Popups Under Pointer
    Display pop-up dialogs centered on the current mouse position, as opposed to centered on the parent window. This generally speeds interaction, and is essential for users who users who set their window managers so keyboard focus follows the mouse.
  • Modification Warnings
    Pop up a warning dialog when files get changed external to nedit. Checking is done both before a save which might overwrite a modified file, and when changes are made to nedit's displayed version of the file.
  • Initial Window Size
    Default size for new windows.

* Changing Font(s)

The font used to display text in NEdit is set under Preferences -> Text Font (for the current window), or Preferences -> Default Settings ->Text Font (for future windows). These dialogs also allow you to set fonts for syntax highlighting. If you don't intend to use syntax highlighting, you can ignore most of the dialog, and just set the field labeled Primary Font.

Unless you are absolutely certain about the types of files that you will be editing with NEdit, you should choose a fixed-spacing font. Many, if not most, plain-text files are written expecting to be viewed with fixed character spacing, and will look wrong with proportional spacing. NEdit's filling, wrapping, and rectangular operations will also work strangely if you choose a proportional font.

Note that in the font browser (the dialog brought up by the Browse... button), the subset of fonts which are shown is narrowed depending on the characteristics already selected. It is therefore important to know that you can unselect characteristics from the lists by clicking on the selected items a second time.

Fonts for syntax highlighting should ideally match the primary font in both height and spacing. A mismatch in spacing will result in similar distortions as choosing a proportional font: column alignment will sometimes look wrong, and rectangular operations, wrapping, and filling will behave strangely. A mismatch in height will cause windows to re-size themselves slightly when syntax highlighting is turned on or off, and increase the inter- line spacing of the text. Unfortunately, on some systems it is hard to find sets of fonts which match exactly in height.

*  Customizing Menus

You can add or change items in the Shell, Macro, and window background menus under Preferences -> Default Settings -> Customize Menus. When you choose one of these, you will see a dialog with a list of the current user-configurable items from the menu on the left. To change an existing item, select it from the list, and its properties will appear in the remaining fields of the dialog, where you may change them. Selecting the item "New" from the list allows you to enter new items in the menu.

Hopefully most of the characteristics are self explanatory, but here are a few things to note:

Accelerator keys are keyboard shortcuts which appear on the right hand side of the menus, and allow you avoid pulling down the menu and activate the command with a single keystroke. Enter accelerators by typing the keys exactly as you would to activate the command.

Mnemonics are a single letter which should be part of the menu item name, which allow users to traverse and activate menu items by typing keys when the menu is pulled down.

In the Shell Command field of the Shell Commands dialog, the % character expands to the name (including directory path) of the file in the window. To include a % character in the command, use %%.

The Menu Entry field can contain special characters for constructing hierarchical sub-menus, and for making items which appear only in certain language modes. The right angle bracket character ">" creates a sub-menu. The name of the item itself should be the last element of the path formed from successive sub-menu names joined with ">". Menu panes are called in to existence simply by naming them as part of a Menu Entry name. To put several items in the same sub-menu, repeat the same hierarchical sequence for each. For example, in the Macro Commands dialog, two items with menu entries: a>b>c and a>b>d would create a single sub menu under the macro menu called "a", which would contain a single sub-menu, b, holding the actual items, c and d:

+---++---++---+
|a >||b >|| c |
+---++---+| d |
          +---+

To qualify a menu entry with a language mode, simply add an at-sign "@" at the end of the menu command, followed (no space) by a language mode name. To make a menu item which appears in several language modes, append additional @s and language mode names. For example, an item with the menu entry:

Make C Prototypes@C@C++

would appear only in C and C++ language modes, and:

Make Class Template@C++

would appear only in C++ mode. Menu items with no qualification appear in all language modes.

If a menu item is followed by the single language qualification "@*", that item will appear only if there are no applicable language-specific items of the same name in the same submenu. For example, if you have the following three entries in the same menu:

Make Prototypes@C@C++
Make Prototypes@Java
Make Prototypes@*

The first will be available when the language mode is C or C++, the second when the language mode is Java, and for all other language modes (including the "Plain" non-language mode). If the entry:

Make Prototypes

also exists, this will always appear, meaning that the menu will always have two "Make Prototypes" entries, whatever the language mode.

*  Sharing Customizations with Other NEdit Users

If you have written macro or shell menu commands, highlight patterns, or smart- indent macros that you want to share with other NEdit users, you can make a file which they can load into their nedit environment.

To load such a file, start nedit with the command:

nedit -import <file>

In the new nedit session, verify that the imported patterns or macros do what you want, then select Preferences -> Save Defaults. Saving incorporates the changes into your own .nedit file, so the next time you run nedit, you will not have to import the distribution file.

Loading a customization file is automated, but creating one is not. To produce a file to be imported by other users, you must make a copy of your own .nedit file, and edit it, by hand, to remove everything but the few items of interest to the recipient. Leave only the individual resource(s), and within those resources, only the particular macro, pattern, style, etc, that you wish to exchange. For example, to share a highlighting pattern set, you would include the patterns, any new styles you added, and language mode information only if the patterns are intended to support a new language rather than updating an existing one. For example:

nedit.highlightPatterns:\
My Language:1:0{\n\
Comment:"#":"$"::Comment::\n\
Loop Header:"^[ \\t]*loop:":::Loop::\n\
}
nedit.languageModes: My Language:.my::::::
nedit.styles: Loop:blue:Bold

Resources are in the format of X resource files, but the format of text within multiple-item resources like highlight patterns, language modes, macros, styles, etc., are private to NEdit. Each resource is a string which ends at the first newline character not escaped with \, so you must be careful about how you treat ends of lines. While you can generally just cut and paste indented sections, if something which was originally in the middle of a resource string is now at the end, you must remove the \ line continuation character(s) so it will not join the next line into the resource. Conversely, if something which was originally at the end of a resource is now in the middle, you'll have to add continuation character(s) to make sure that the resource string is properly continued from beginning to end, and possibly newline character(s) (\n) to make sure that it is properly separated from the next item.

 

<< Previous Section
Customizing NEdit
Table of Contents
Next Section >>
X Resources

 

 

. . Released on  Wed, 6 Nov 2002  by C. Denat