## 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 provide initial settings for future windows created using the New or Open commands; options affecting all windows are also set here. Preferences set in the Default Settings sub-menu can 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 -> Programming with NEdit 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 Help -> Features for Programming -> 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 omitted 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.

    Tab Stops

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 Help -> Features for Programming -> Syntax Highlighting 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).

    Show Matching (..)

Momentarily highlight matching parenthesis, brackets, and braces, or the range between them, when one of these characters is typed, or when the insertion cursor is positioned after it. Delimiter only highlights the matching delimiter, while Range highlights the whole range of text between the matching delimiters.

Optionally, the matching can make use of syntax information if syntax highlighting is enabled. Alternatively, the matching is purely character based. In general, syntax based matching results in fewer false matches.

    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 different 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: Features for Programmers -> 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.

    Colors...

Change the colors used to display text. The "Matching (..)" fields change the colors that matching parens, brackets and braces are flashed when the "Show Matching (..)" option is enabled. Note that the foreground colors for plain text, selected text, and matching paren flashing only apply when syntax highlighting is disabled. When syntax highlighting is enabled, text (even text that appears plain) will always be colored according to its highlighting style. (For information on changing syntax highlighting styles and matching patterns use see Help -> Features for Programming -> Syntax Highlighting.)

    Customize Menus

Add/remove items from the Shell, Macro, and window background menus (see below).

    Customize Window Title

Opens a dialog where the information to be displayed in the window's title field can be defined and tested. The dialog contains a Help button, providing further information about the options available.

    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 (unless Beep On Search Wrap is turned on).

Wrap Around - Search and Replace operations wrap around the beginning (or end) of the file.

Beep On Search Wrap - Beep when Search and Replace operations wrap around the beginning (or end) of the file (only if Wrap Around is turned on).

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.

Default Replace Scope - [THIS OPTION IS ONLY PRESENT WHEN NEDIT WAS COMPILED WITH THE

       -DREPLACE_SCOPE FLAG TO SELECT AN ALTERNATIVE REPLACE DIALOG LAYOUT.]

Initial setting for the scope in the Replace/Find dialog, when a selection exists. It can be either "In Window", "In Selection", or "Smart". "Smart" results in "In Window" if the size of the selection is smaller than 1 line, and to "In Selection" otherwise.

    Syntax Highlighting

Program and configure enhanced text display for new or supported languages (See Features for Programming -> Syntax Highlighting).

    Tabbed Editing

Options for controlling the tabbed interface:

Open File in New Tab - Open files in new tabs, else open files in new windows.

Show Tab Bar - Show/Hide the tab bar.

Hide Tab Bar when only one Document is open

Next/Prev Tabs Across Windows - Suppose there are two windows with three tabs in the first window and two tabs in the second window. Enabling this option, if you are on the third tab in the first window, hitting Ctrl+PageDown would switch to the first tab in the second window (instead of switching to the first tab in the first window).

Sort Tabs Alphabetically

    Show Tooltips

Show file name and path in a tooltip when moving the mouse pointer over a tab (See Basic Operations -> Tabbed Editing).

    Terminate with Line Break on Save

Some UNIX tools expect that files end with a line feed. If this option is activated, NEdit will append one if required.

    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 set their window managers so keyboard focus follows the mouse.

    Auto-Scroll Near Window Top/Bottom

When this option is enabled the window will automatically scroll when the cursor comes 4 lines from the top or bottom of the window (except at the beginning of the file). The number of lines can be customized with the nedit.autoScrollVPadding resource.

    Warnings

Options for controlling the popping up of warning dialogs:

File Modified Externally - Pop up a warning dialog when files get changed external to NEdit.

Check Modified File Contents - If external file modification warnings are requested, also check the file contents iso. only the modification date.

Exit Warnings - Ask before exiting when two or more files are open in an NEdit session.

    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.

### The NEdit Preferences File

The NEdit saved preferences file is an X resource file, and its contents can be moved into another X resource file (see X Resources). One reason for doing so would be to attach server specific preferences, such as a default font to a particular X server. Another reason for moving preferences into the X resource file would be to keep preferences menu options and resource settable options together in one place. Though the files are the same format, additional resources should not be added to the preference file since NEdit modifies this file by overwriting it completely. Note also that the contents of the preference file take precedence over the values of X resources. Using Save Defaults after moving the contents of your preference file to your .Xdefaults file will re-create the preference file, interfering with the options that you have moved. The location of NEdit's preferences file depends on your environment:

- The default place for the file is '$HOME/.nedit/nedit.rc',
- if the variable $NEDIT_HOME is set in your environment it is located at '$NEDIT_HOME/nedit.rc',
- you may also use old-style run control files; in this case, the preferences are stored in $HOME/.nedit.

(For VMS, the file is in '$NEDIT_HOME/nedit.rc' if $NEDIT_HOME is set, in 'SYS$LOGIN:.nedit' otherwise.)

### 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 the nedit preferences 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 configuration 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.