NEdit, the universal editor of the Unix world

ArticleCategory: [Choose a category for your article]

Applications

AuthorImage:[Here we need a little image form you]

[Photo of the Author]

TranslationInfo:[Author and translation history]

original in fr Georges Tarbouriech 

fr to en Georges Tarbouriech

AboutTheAuthor:[A small biography about the author]

Georges is a long time Unix user (commercial and free). He likes NEdit and uses it on 4 different Unixes.

Abstract:[Here you write a little summary]

NEdit is a very user-friendly graphical editor, ideal for development. It is available for for more than 20 Unix systems.
This article is meant as an introduction to NEdit. It is not a in depth review of the editor and it's features.

ArticleIllustration:[This is the title picture for your article]

[Illustration]

ArticleBody:[The article body]

A bit of history

What would be the Unix world without editors? Yes, you can ask this question for almost any operating system; but once again, Unix world has been a precursor. Originally Unix systems did not have graphical interfaces, they ran in text mode. The user-friendliness was not what we are currently used to.
The text interface lead to the unavoidable vi, an editor with a rather rough interface. vi is to Unix what DOS is to Windows, they belong together. Eventually, vi evolved into vim (for vi-im...proved). It provided improvements such as allowing to delete a character before the cursor using the "backspace" stroke: a revolution!
Sorry, I am just a bit ironic... vi is still very useful. It has wide range of features and can do things that no other editor can. Nevertheless, when you start using vi, it's recommended to have an user manual by your side. You can not click on a menu bar, open the menu entry and see the available possibilities. In vi you have to know what the commands and features are.
The second "heavyweight" in the category is the work of R. Stallman, "father" of GNU; without him, we wouldn't be able to share the joys of free software. Of course, we are talking about Emacs, also known as EscapeMetaAltControlShift. Clearly speaking, it's an editor reserved for octopuses or to be used on computers equipped with pedals.
More seriously, Emacs is a fantastic editor but it requires a steep learning curve to get used to the control sequences providing its true power.
The graphical version, Xemacs, is even more powerful. It's a Swiss army knife: an editor, a news reader, a browser... just about anything. Sort of an everything rolled up into one application. To get a better idea about it's size: a Xemacs compilation on a m68k 68030/25mhz with Linux and 16 Meg RAM (I know, you must be crazy) only lasts 18 hours. Both products (three, by separating out the powerful Xemacs) have been used in Unix from the beginning. Now they have been ported to many other operating systems. It isn't a coincidence that these editors are recommendations. Today, free Unixes have become widely used and development under these operating systems has accelerated. There are now, at least, fifty editors available for use in the Unix world.
Then, why NEdit?

Introduction

NEdit is available from: http://nedit.org/

Both the source code and pre-compiled binaries are available.
Since not so long ago (December 1999) NEdit was not licensed under the GPL. It is therefore still today not provided directly as a part of Linux, NetBSD, FreeBSD... distributions.
For this reason and due to competition from other editors, most free Unix users have not had direct access and have missed the opportunity to use NEdit. Since its creation at Fermi National Accelerator Laboratory, NEdit has been distributed under the Fermitools license. Additionally, NEdit uses the Motif library. Until recently, there was no way to use NEdit without purchasing Motif - a commercially available, graphical interface library.
Fortunately, with the wide availability of shareware/freeware on the free operating systems available, Motif has a free equivalent: Lesstif. Thanks to Lesstif, future versions of NEdit will fall under the Gnu Public License, GPL! Now since NEdit comes with a GPL licence it will probably be part of many free Operating Systems distributions.
Currently, Lesstif is still under development slowly reaching maturity. A few problems exist, particularly concerning the mouse clicks, but it's nothing serious. I will come back to this later on.

Presentation


Variations

Originally NEdit was distributed for commercial Unixes, because of Motif.
There are versions for Irix (SGI), Solaris (Sun), AIX (IBM), HP-UX, VMS... precompiled with Motif.
For Linux, FreeBSD, NetBSD, you can download the source code and compile it will Lesstif ( http://www.lesstif.org)

However, you can also find precompiled versions linked with Motif for wide spread Linux architectures such as e.g Intel based PCs (i386/i486/i586...).
If you own a rather exotic Linux version (m68k, for example), or OpenBSD, NetBSD... precompiled versions are linked with Lesstif.

A few infos about some Unix versions:
NEdit is part of Irix distributions. There is a freeware version available, as well. If you install the freeware version then remove the one that came with Irix. They don't work very well together.
For Solaris 2.6, download the precompiled version linked with Motif. Another option would be to install Sun provided patches, available from http://www.sun.com.
The original Solaris Motif shared libraries are buggy.
Installation is quite simple: just copy executables to a location of your choice. I say executables, because there is a client version called nc. It allows NEdit to be used in client-server mode.


Description

artned.jpg

Window in a window

NEdit is a graphical editor, with many features.
The graphical interface allows NEdit to be fully mouse driven through menus. It has keyboard shortcuts, dialog boxes... Configuration is provided through a Preferences menu. The settings which are stored in an .nedit file which can also easily be modified manually by editing it with NEdit and it provides the personal touch most Unix users are used to. Configuration options are numerous through X Resources. For example, you can define syntax highlighting for selected files. These can be selected from a long list (C, Fortran, Pascal, HTML...)
You can define your own syntax highlighting, as well, using patterns. A pattern consists of a corresponding regular expression for each style representing fonts and colors. If your text matches this regular expression, it is displayed with the selected color and font.
When you open a *.c file, for instance, NEdit sets specific highlighting and indentation to make reading easier.
If the file extension does not match your file you can also activate syntax highlighting simply by selecting the right language from the Preferences menu.
Of course many essential features are available. Let's start with the unavoidable Cut, Copy, and Paste, Find and Replace, line numbers...
An interesting feature allows selecting columns of text to copy and paste them.
If you work with a three button mouse, you get even more options, such as secondary selection. This will replace selected text (primary selection) without cutting it first.
Another remarkable feature: filling paragraphs. I don't want to explain it here. I leave the pleasure of discovering the concept to you. Take a look at the provided documentation.
This is of course not all, NEdit can do much better. You can run Shell commands into a window. The output displays at the cursor position.
It's quite easy to create macros in an interactive mode. In fact, NEdit has its own macro language. This provides the possibility to create a private set of tools to improve efficiency.
NEdit can interface via the nc client with Integrated Development Environments (such as e.g SGI CaseVision).
Programmers can check matching parentheses or brackets simply by selecting a menu item.
It's also possible to open an "include" file automatically.
If you open a C file source and select a line such as
#include "config.h"
then you can go to the menu item "Open selected", and NEdit will display the "config.h" file.
An other very nice feature: NEdit is able to do regular expressions search.
Go and visit the contrib directory on fnal ftp server ftp://ftp.fnal.gov/pub/nedit or check the macro directory at http://www.nedit.org/macro to tune the editor features even further.


Configuration


As we have seen it before, NEdit configuration is done from the Preferences menu. Most of the options can be selected from this menu.
Default settings have a main menu and a submenu.
The main menu applies to the current window while the submenu concerns NEdit in general.
From the main menu you can set a language to define syntax highlighting, indentation, wordwrap, margins, fonts...
>From the submenu you get more options such as customization for some menu items. If you save the settings, NEdit creates a file and reads it each time you open the application.
This is obvious and doesn't deserve a long speech, and... more on this can be found in the documentation.

NEdit allows more sophisticated configuration using X config files.
The file which is created when saving Preferences has the same format as .Xdefaults or .Xresources. Thus, you can directly copy the content of this .nedit file into one of the above mentioned files.
Such customization (via Xresources) is interesting for a few Unixes and it allows NEdit to take advantage of system features. It is also necessary if you wish to modify keyboard shortcuts.

The most common reason for doing this, is to modify the Delete key. By default the Delete key acts as the Backspace key. With Xresources you can change it.

A few tips

The versions compiled with Lesstif sometimes give the mouse a special behavior. For instance, it can be difficult to select a file from the dialog box. The solution: press the Return key instead of double-clicking once the filename is selected.
Another small problem concerns the Open dialog window. It's possible that no files appear in that window. Then, add a trailing "/" to the directory name into the filter field.
An usual one: keyboard shortcuts don't work. Deactivate CapsLock and NumLock, and... it should work.

Using NEdit

You can start NEdit typing the command "nedit" or by double-clicking on it's icon. Desktop icons and start menu depend of course on the Windowmanager that you are using.
Normally you open one instance per file. If you open ten files, you'll launch NEdit ten times. It's a common behavior, sometimes a bit annoying. Personally, I'm a lucky Amiga user (yes, it does exist!) and I'm able to open a lot of files in the same window.
Now I succeeded in placing the Amiga in an article about Unix, let's go back to NEdit.
Operating NEdit is obvious. Everything can be done from menu items or keyboard shortcuts. The mouse is quite important as we are in a graphical environment and if it is a three button mouse it is even better.
If you are fond of keyboard shortcuts, there is a long list.
A few examples:
Ctrl + Backspace delete the word before the cursor
Ctrl + U delete to start of line
Ctrl + Delete delete to end of line
Ctrl + right arrow move the cursor forward one word. Left arrow does the same backward.
Ctrl + Return return with automatic indent


You can set a default window size and split the window for the same file. This option makes it easier the work on large text.
Finding and replacing text provides you with options where you can for instance influence case sensitivity.
The menu options "Find again" and "Replace again" allow to continue the search and/or the replacement of the same string in the whole document.
These options also work for selected text, even if the text is found in another window, or another application.
Creating a macro is very simple too. You just have to choose the learning mode in the macro menu, selecting "Learn keystrokes". NEdit will then learn keystrokes and menu commands. Selecting the "Paste learn" button within the macro creation dialog box will paste the result into the macro body.
In case of system crash (very rare, we are under Unix...) you can get your work back. NEdit duplicates the file you're working on: you'll just have to rename this file to recover it almost as it was before the crash.
The online help is quite complete.
In short, this tool is quite easy to discover. It probably is a main factor for using Nedit besides its numerous features.

Last words

As for a lot of overabundant applications, everyone chooses according to his taste, his needs. NEdit is not the ultimate tool but it is one of the very best.
It's far from being ridiculous in the middle of the "heavyweight".
It doesn't need much resources while being quite performing and once again, user-friendly.
If you come from MAC, PC or BeOS, AmigaOS, NEdit will look familiar to you.
The license problem is now resolved and Lesstif is improving every day.
Accordingly, why waiting for NEdit to become part of your Linux distribution. Try it now: nedit.org
You won't be disappointed.
We're living in a great time!

mirror server hosted at Truenetwork, Russian Federation.