Customizing nedit

Nedit is a simple to use text editor for linux suitable for editing text files.

Getting the delete key to work

To get the delete key to work in nedit, add
     keycode 129 = 0x4    
to 'keymaps' and put 'xmodmap keymaps' in .xinitrc. Then add
     nedit*text*Translations: #override \n\
     <Key>0x4: delete-next-character() \n    
to your .Xdefaults file.

Editor tries to execute each line of text as a command

Edit 'keymaps', change keycode 108 from `KP_Enter' to `Return' and run `xmodmap keymaps'.

Getting escape key to close windows

By default, nedit pops up an information box saying "Search string not found" after a search. It is necessary to press Enter or Space to dismiss the box.

Edit util/DialogF.c at 'addEscapeHandler' (line 369). If addEscapeHandler is called with NULL, escape key is disabled. Remove lines 368-370 and recompile. This will allow Esc to dismiss the box.
/* If the button labeled cancel or dismiss is not the cancel button, or
   if there is no button labeled cancel or dismiss, redirect escape key
   events (this is necessary because the XmNcancelButton resource in
   the bulletin board widget class is blocked from being reset) */
/*if (cancel_index == -1)
    addEscapeHandler(dialog, NULL, 0);
else if (cancel_index != CANCEL_BTN)
    addEscapeHandler(dialog, &df, cancel_index);*/

Changing the default cursor

The default cursor in Nedit is a gigantic black arrow that obscures the text and can be very annoying.

  1. Edit source/window.c and add at the following line at the top of the file
    #include <X11/cursorfont.h>
  2. At the top of function CreateWindow(), add
    Cursor cursor;
  3. At the bottom of function CreateWindow() near line 527, add the two lines shown:
    cursor = XCreateFontCursor(TheDisplay, XC_xterm);
    XDefineCursor(TheDisplay, XtWindow(window->textArea),cursor);
        return window;    

Other possibilities are XC_crosshair, XC_top_left_arrow, and XC_draft_small.

Getting rid of XmPushButton errors

On my computer, nedit prints the following on the screen every time a file is opened:
Name: executeCommandLine
Class: XmPushButton
Illegal mnemonic character;  Could not convert X KEYSYM to a keycode
To get rid of this, edit nedit.c and comment out the shellMenu lines (near line 242-245) in the fallbackResources section and recompile it. No doubt there's an easier way but this is the most permanent.
"*shellMenu.executeCommandLine.accelerator: Ctrl<Key>KP_Enter",
"*shellMenu.executeCommandLine.acceleratorText: Ctrl+KP Enter",