Hints and Tricks (ne’s manual)

Next: Motivations and Design, Previous: Configuration, Up: Top [Contents][Index]

## 6 Hints and Tricks

Use `f1` or `Escape`-`Escape`, not `Escape`.

  Due to the limitations of the techniques used when communicating with a terminal, it is not possible to “decide” that the user pressed the `Escape` key for about a second after the actual key press (see EscapeTime). This means that you will experience annoying delays when using menus. If you have no `f1` key, use `Escape`-`Escape`, or redefine a keystroke assigning the command `Escape`, and you will be able to use that keystroke instead of `Escape`. Unfortunately, some GUI-based terminals (most notably, `gnome-terminal`) use `f1` for their own purposes; in that case, you can assign the `Escape` command to another key (see Configuration).

Check for the presence of a `Meta` key.

  If your system has a standard `Meta` or `Alt` key, there is a good chance that you have several other shortcuts. If the built-in `Meta` bindings do not work, you must discover which is the effect of the `Meta` in your terminal emulator. Indeed, it is possible in theory to configure about 150 shortcuts. See Configuration. In any case, prefixing a key with `Escape` has the same effect as holding down `Meta`, so with the standard key bindings you can, for instance, advance by word with `Escape` followed by `F`.

When editing very large files, please use the `--no-syntax` option.

  Even if `ne` will switch transparently to memory-mapped disk files, syntax highlighting requires a great deal of additional memory.

Mac users should turn on “Delete sends CTRL-H” in the `Terminal` settings.

  If you are a Mac user, you need to check the “Delete sends CTRL-H” option in the ‘`Advanced`’ tab of the `Terminal` application settings.

`ne` does tilda expansion.

  When you have to specify a file name, you can always start with `~/` in order to specify your home directory, or `~user/` to specify the home directory of another user.

It is easy to correct bad colors.

  Sometimes, due to different opinions about the best default foreground and background colors, some of the color choices in a syntax file might be unreadable (for instance, ‘`dim white`’ on a terminal with a white background). Just copy the guilty syntax specification file to the `~/.ne/syntax` directory, and change the color names at the start of the file.

Use the ‘`tabs`’ syntax to distinguish TABs from SPACEs.

  When you’re struggling to clean up a mix of TABs and SPACEs, temporarily switching to the ‘`tabs`’ syntax may help. The command `Syntax tabs` makes TAB characters show up in a different background color from SPACEs. Once you’ve gotten your white space issues straightened out, you can switch back to the syntax appropriate for your current file type.

`ne` does interactive filename completion.

  When you have to specify a file name as last element of a long input, you can invoke the completer using `Tab`. If you hit it twice in a row, you will enter the file requester, where you can navigate and escape back to the command line, either with `f1`, which will let you edit again your previous input, or with `Tab`, which will copy your current selection over your previous file name. In other words, you can freely alternate completion, editing and browsing.

Disable the status bar for slow connections.

  `ne` tries to emit as few characters as possible when updating the screen. However, for each key you type it is likely that the status bar has to be updated. If your connection is very slow, you can disable the status bar to get a quicker response (see StatusBar).

The `Escape` delay when activating menus can be avoided.

  If you press after `Escape` any key that does not produce the second character of an escape sequence, `ne` will immediately recognize the `Escape` key code as such. Since non-alphabetical keys have no effect while browsing through the menus, if you’re forced to use `Escape` as menu activator you can press, for instance, ‘`,`’ just after it to speed up the menu activation (note that ‘`:`’ would not work, because it would activate the command line). Alternatively, you can just type `Escape` twice in a row.

Use turbo mode for lengthy operations.

  Turbo mode (see Turbo) allows performing very complex operations without updating the screen until the operations are complete. This can be a major plus if you are editing very long files, or if your terminal is slow. If the default value (0, which means twice the number of visible rows) does not give you the best results, experiment other values.

Regular expressions are powerful, and slow.

  Regular expressions must be studied very carefully. If you spend a lot of time doing editing, it is definitely reasonable to study even their most esoteric features. Very complex editing actions can be performed by a single find/replace using the `\n` convention. But remember always that regular expressions are much slower than a normal search: in particular, if you use them on a UTF-8 text, `ne` has to transform them into an equivalent (but more complex) expression that cannot match partially a UTF-8 sequence, and this expansion makes the search even slower.

Use the correct movement commands in a macro.

  Many boring, repetitive editing actions can be performed in a breeze by recording them the first time. Remember, however, that while recording a complex macro you should always use a cursor movement that will apply in a different context. For instance, if you are copying a word, you cannot move with cursor keys, because that word at another application of the macro could be of a different length. Rather, use the next/previous word keys and the `MoveEOW` command, which guarantee a correct behaviour in all situations.

Some preferences can be preserved even with automatic preferences.

  When you save an autoprefs file, the file simply contains a macro that, when executed, produces the current configuration. However, you could want, for instance, to never change the insert/overwrite state. In this case, just edit the autoprefs files with `ne` and delete the line containing the command setting the insert flag. When the autoprefs are loaded later, the insert flag will be left untouched. This trick is particularly useful with the `StatusBar` and `FastGUI` commands.

If some keystrokes do not work, check for system-specific features.

  Sometimes it can happen that a keystroke does not work—for instance, `Control-O` does not open a file. This usually is due to the kernel tracking that key for its purposes. For instance, along a `telnet` connection with xon/xoff flow control, `Control-S` and `Control-Q` would block and release the output instead of saving and quitting.

  In these cases, if you do not need the system feature you should check how to disable it: for instance, some BSD-like systems feature a delayed suspend signal that is not in the POSIX standard, and thus cannot be disabled by `ne`. On HP-UX, the command `stty dsusp ^-` would disable the signal, and would let the control sequence previously assigned to it to run up to `ne`.

Next: Motivations and Design, Previous: Configuration, Up: Top [Contents][Index]