2.4 Editing

An editor is presumably used for editing text. If you decide not to edit text, you probably don’t want to use ne, because that’s all it does—it edits text. It does not play Tetris. It does not evaluate recursive functions. It does not solve your love problems. It just allows you to edit text.

The design of ne makes editing extremely natural and straightforward. There is nothing special you have to do to start editing once you’ve started ne. Just start typing, and the text you type shows up in your document.

ne provides two ways of deleting characters: the Backspace key (or Control-H, if you have no such key) and the Delete key. In the former case you delete the character to the left of the cursor, while in the latter case you delete the character just under the cursor. This is in contrast with many UN*X editors, which for unknown reasons decide to limit your ways of destroying things—something notoriously much funnier than creating. (See DeleteChar and Backspace.)

If you want to delete a line, you can use the DeleteLine command, or Control-Y. A very nice feature of ne is that each time a nonempty line is deleted, it is stored in a temporary buffer from which it can be undeleted via the UndelLine command or Control-U. (See DeleteLine and UndelLine.)

If you want to copy, cut, paste, shift or erase a block of text, you have to set a mark. This is done via the Mark command, activated by choosing the ‘Mark Block’ item of the ‘Edit’ menu, or by pressing Control-B (think “block”). This command sets the mark at the current cursor position. Whenever the mark is set, the text between the mark and the cursor can be cut, copied or erased. Note that by using Control-@ you can set a vertical mark instead, which allows you to mark rectangles of text. Whenever a mark has been set, either an ‘M’ appears on the command line or a ‘V’ appears if the mark is vertical. If you forget where the mark is currently, you can use the ‘Goto Mark’ menu item of the ‘Search’ menu to move the cursor to it.

The block of text you cut or copy is saved in a clip, which you can ‘Paste’ somewhere else in your document, or save it to a file with the ‘Save Clip...’ menu item of the ‘Edit’ menu. You can also load a file directly into a clip with ‘Open Clip...’, and ‘Paste’ it anywhere. All such operations act on the current clip, which is by default the clip 0. You can change the current clip number with the ClipNumber command. See ClipNumber.

One of the most noteworthy features of ne is its unlimited undo/redo capability. Each editing action is recorded, and can be played back and forth as much as you like. Undo and redo are bound to the function keys f5 and f6.

Another interesting feature of ne is its ability to load an unlimited number of documents. If you activate the NewDoc command (using the ‘Document’ menu or the command line), a new, empty document will be created. You can switch between your documents with f2 and f3, which are bound to the PrevDoc and NextDoc commands. If you have a lot of documents, the ‘Select...’ menu item (f4) prompts you with the list of names of currently loaded documents and allows you to choose directly which to edit. In that list, names of documents with unsaved changes will be bold. You can also change their relative order in that list with the f2 and f3 keys.