NEdit has some options which cannot be set using the Preferences menu, but which are instead set using X resources. Like many other X programs, NEdit can be customized to vastly unnecessary proportions, from initial window positions down to the font and shadow colors of each individual button (A complete discussion of how to do this is left to books on the X Windows System). Key binding (see below) is one of the most useful of these resource settable options.
X resources are usually specified in a file called .Xdefaults in your home directory. On some systems, this file is read and its information attached to the X server (your screen) when you start X. On other systems, the .Xdefaults file is read each time you run an X program. When X defaults are attached to the server, you can use a program called xrdb to update them without restarting X.
The .nedit (saved preferences) file is in the same format as an X resource file, and its contents can be moved into your X resource file. 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 .nedit file; they will not be read, and NEdit modifies this file by overwriting it completely. Also note that the contents of the .nedit file take precedence over the values of X resources. Using Save Defaults after moving the contents of your .nedit file to your .Xdefaults file will re-create the .nedit file, interfering with the options that you have moved.
The following are selected NEdit resource names and their default values. For NEdit options settable via the Preferences menu, see the section titled Preferences. The resource names for preference resources can be found in your .nedit file.
nedit.tagFile: (not defined) -- The name of a file of the type produced by
the UNIX ctags command which NEdit will load at startup time (see
Features for Programmers). The tag file provides a database from which
NEdit can automatically open files containing the definition of a
particular subroutine or data type.
nedit.shell: /usr/interp/bash -- (UNIX systems only) The UNIX shell (command
interpreter) to use for executing commands from the Shell menu
nedit.wordDelimiters: .,/\\`'!@#^&*()-=+{}[]":;<>? -- The characters, in
addition to blanks and tabs, which mark the boundaries between words for
the move-by-word (Ctrl+Arrow) and select-word (double click) commands.
nedit.remapDeleteKey: True -- Setting this resource to False restores the
original Motif binding of the delete key to forward-delete. This binding
causes problems when X servers with one delete/backspace configuration
are connected with X clients of the other. Users with a backspace key in
the backspace/delete position who use only machines with such style of
keyboard can set this resource to False to get back the forward-delete
function of the delete key.
nedit.printCommand: (system specific) -- Command used by the print dialog
to print a file, i.e. lp, lpr, etc..
nedit.printCopiesOption: (system specific) -- Option name used to specify
multiple copies to the print command. If the option should be separated
from its argument by a space, leave a trailing space. If blank, no
"Number of Copies" item will appear in the print dialog.
nedit.printQueueOption: (system specific) -- Option name used to specify a
print queue to the print command. If the option should be separated from
its argument by a space, leave a trailing space. If blank, no "Queue"
item will appear in the print dialog.
nedit.printNameOption: (system specific) -- Option name used to specify a
job name to the print command. If the option should be separated from
its argument by a space, leave a trailing space. If blank, no job or file
name will be attached to the print job or banner page.
nedit.printHostOption: (system specific) -- Option name used to specify a
host name to the print command. If the option should be separated from
its argument by a space, leave a trailing space. If blank, no "Host" item
will appear in the print dialog.
nedit.printDefaultQueue: (system specific) -- The name of the default
print queue. Used only to display in the print dialog, and has no effect
on printing.
nedit.printDefaultHost: (system specific) -- The node name of the default
print host. Used only to display in the print dialog, and has no effect
on printing.
nedit*text.foreground: black -- Foreground color of the text editing area
of the NEdit window.
nedit*text.background: gray90 -- Background color of the text editing
area of the NEdit window.
nedit*text.blinkRate: 600 -- Blink rate of the text insertion cursor in
milliseconds. Set to zero to stop blinking.
nedit*text.Translations: -- Modifies key bindings (see below).
One of the most useful customizations to NEdit is to change the bindings of editor actions to keys to fit a particular style of editing. The topic Motif Editor Function lists the actions available in NEdit. To bind actions to keys, add lines similar to the following to your X resource file:
NEdit*text.Translations: #override \
Ctrlv: insert-string("VEE!") process-up()\n\
osfDelete: delete-previous-character()\n
You will need to refer to a book on the X window system for the exact syntax of translation tables. Translation tables map key and mouse presses, window operations, and other kinds of events to actions. The syntax (somewhat oversimplified) is a keyword; #override, #augment, or #replace; followed by lines (separated by newline characters) pairing events with actions. Events begin with modifiers, like Ctrl, Shift, or Alt, followed by the event type in <>. BtnDown, Btn1Down, Btn2Down, Btn1Up, Key, KeyUp are valid event types. For key presses, the event type is followed by the name of the key. You can specify a combination of events, such as a sequence of key presses, by separating them with commas. The other half of the event/action pair is a set of actions. These are separated from the event specification by a colon and from each other by spaces. Actions are names followed by parentheses, optionally containing a single parameter.
The menu shortcut keys shown at the right of NEdit menu items can also be changed via X resources. Each menu item has two accelerator key resources associated with it, accelerator, and acceleratorText. accelerator sets the actual event that triggers the menu item, and is in the same form as the events for translation table entries discussed in the previous section. acceleratorText contains the entry that will be displayed with the menu item. To construct the complete resource name, use one of *fileMenu, *editMenu, *preferencesMenu, *windowsMenu, or *shellMenu, followed by `.' and the name of the menu item (lower case, run together with words separated by caps and with all punctuation removed), followed by .accelerator, or .acceleratorText. For example, to change Cut to Ctrl+X, you would add the following to your .Xdefaults file:
nedit*editMenu.cut.accelerator: Ctrlx nedit*editMenu.cut.acceleratorText: Ctrl+X
Accelerator keys with optional shift key modifiers, like Find..., have an additional .accelerator resource with Shift appended to the name. To change the accelerator key for the Find... command to Alt+F, you would use the following:
nedit*searchMenu.find.acceleratorText: [Shift]Alt+F nedit*searchMenu.find.accelerator: Altf nedit*searchMenu.findShift.accelerator: Shift Alt f
Select a topic for more information.
Return to the Software page.
Return to ACS home page.
Please send comments and suggestions to
consult@rpi.edu