Tips & Tricks

You have a system at work where only vim, emacs and the like are installed.

Do not argue with the system administrator. You can easily install NEdit locally in your home directory: Create a subdirectory, e.g. bin. Download the NEdit binaries for your system from Copy the binaries nedit and nc to bin. Now you can run NEdit with bin/nedit & or from other directories with ~/bin/nedit &. (Make sure that the file is executable. It should be already when you unpack it. If not use chmod.)
In order to use nc, add the entry nc.serverCommand: ~/bin/nedit -server to the .Xdefaults or .Xresources file in your home directory (or create such a file, if it should not be there already). Then give in xrdb .Xdefaults, so that the new X settings take effect. Now you can start NEdit with ~/bin/nc without your system administrator knowing. Of course, if you add ~/bin to the start of your PATH variable, you can simply type nc.

You are working with many files at the same time.

NEdit v5.5 has a Mozilla like tabbed interface. If you work with really many files, perhaps this macro can help. (Notice that NEdit needs to be in server mode, i.e., start NEdit through nc.)
If there is some relation between the files you work on, for example a webpage, or a program split over many files, the project macros may help.

You are writing your own macro functions and want to debug them.

You can check a newly written macro function by simply loading it from the File Menu. Suppose you have a macro function in the file my_function.nm. Go to the File Menu and invoke Load Macro File. In the dialog choose my_function.nm and load it. If you have edited your macro, simply re-load it. Even better there is a macro doing this for you.

Global variables in macro menu definitions

Sometimes you may need a global variable in a macro, such that the value of the variable can be recalled when the macro runs next time. But you have the problem that the variable can not be initialised to a start value there, because calling the macro again would overwrite the actual value that you need (that's why you use a global variable) with the start value again. The known solution is to initialise the variable in the autoload macro file (autoload.nm). However this is often annoying, especially for short macros. Assume for example that you want to create a second clipboard (in addition to Ctrl+X,C,V). It looks simple: For cutting and copying we have

$clip = get_selection()
$clip = get_selection()
respectively. However the macro for pasting,
 if ($clip != "") insert_string($clip)
will give an error, unless the variable $clip exists. So to correct it, you had to initialise $clip = "" in autoload.nm.

However, since NEdit supports arrays, there is a trick to avoid it. We can write

$clip[""] = ""
if (!(1 in  $clip)) $clip[1] = ""
if ($clip[1] != "") insert_string($clip[1])
Here the first line is an unused dummy value. This line only ensures that the array $clip exists. Then the second line is valid, and initialises the actual variable to store our copied or cut string for later pasting, which now is an array entry, namely $clip[1]. Of course, in the copy and cut macros, you have to replace $clip with $clip[1]. (By the way, the number 1 only indicates that you can have a whole lot of clipboards in the same way.)
Another example is the simple word completion macro, derived from NEdit's built-in word completion.

You are working with a variety of programming and/or mark-up languages.

You can make macros language dependent. Simply add a @[language] to the name of the menu entry for the macro, where [language] stands for a language mode of NEdit, e.g. C, C++, LaTeX, SGML HTML, XML and so on. If the macro shall be present for more than one language mode add @[language1]@[language2] and so on. Notice that short-cuts for a menu entry are only active in the language mode in which the menu entry is defined. So you can give the same short-cuts many times (for different language modes).
If you have a macro that shall be there for all language modes, except a few ones which need a slightly modified version of the macro, you can use @* for this macro and overwrite it with the special versions that get the same menu name and a @[language] behind it.