Next: , Up: Reference   [Contents][Index]


3.1 Arguments

The main arguments you can give to ne are the names of files you want to edit. They will be loaded into separate documents. If you specify --help anywhere on the command line, a simple help text describing ne’s arguments will be printed.

The +N option causes ne to advance to the Nth line of the next document loaded. This option is fairly common among editors and text display programs like vi and less. The N itself is optional. Without it, a bare + on the command line causes ne to advance to the last line of the first document. You can specify a line and column as +N,M. Any non-digit can be used to separate the N from the M. As it only affects the next document loaded, it can appear multiple times on the command line.

The --binary option causes ne to load the next document in binary mode. Binary mode treats the normal line termination characters as any other character and only breaks lines on NULL characters. Like +N,M, --binary only affects the next document loaded, and it can appear multiple times on the command line. See Binary.

The --read-only option causes ne to load the next named file into a read-only document. You can still Save (Save) a read-only document to a file if the file’s permissions allow it, but you can’t modify a read-only document without taking special action such as turning off the read-only flag first. The --read-only option only affects the next document loaded, so it can appear multiple times on the command line. A document’s read-only flag is automatically set when a file is loaded if the corresponding file is not writable (as determined by the access() system call) regardless of whether the --read-only option is used. See ReadOnly.

The --no-config option skips the reading of the key bindings and menu configuration files (see Configuration). This is essential if you are experimenting with a new configuration and you make mistakes in it.

The --prefs extension option makes ne load a specified set of automatic preferences, that is, those associated with the provided extension, instead of the default ones, before loading the first file. It can be useful, for instance, when piping a file into ne or when reading from named pipes, as in those cases there is no file extension from which ne can guess the correct preferences. Note that preferences are cloned from the current document when a new document is created, so if you open a number of files without extension this option will propagate to all of them.

The --macro filename option specifies the name of a macro that will be started just after all documents have been loaded. A typical macro would move the cursor to a certain line.

The --keys filename option and the --menus filename option specify a name different from the default one (.keys and .menus, respectively) for the key bindings and the menu configuration files. Note that ne searches for these files first in the current directory, and then in your ~/.ne directory.

The --ansi and the --no-ansi options manage ne’s built-in ANSI sequences. Usually ne tries to retrieve from your system some information that is necessary to handle your terminal. If for some reason this is impossible, you can ask ne to use a built-in set of sequences that will work on many terminals using the --ansi option (to be true, ne can be even compiled so that it uses directly the built-in set, but you need not know this). If you want to be sure (usually for debugging purposes) that ne is not using the built-in set, you can specify --no-ansi.

The --no-syntax option disables ne’s normal syntax highlighting capability. For most editing situations, this would be unnecessary, but for extremely large files it may be helpful. Syntax highlighting incurs small memory usage and processor overhead penalties for each line of text. The --no-syntax option eliminates that overhead. Note that files longer than ten million bytes will have syntax highlighting disabled by default, but it is possible to re-enable it. See Syntax Highlighting.

The --utf8 and --no-utf8 options can be used to force or inhibit UTF-8 I/O, overriding the choice imposed by the system locale. Note, however, that in general it is more advisable to set the LANG environment variable to a locale supporting UTF-8 (you can usually see the locale list with locale -a). See UTF-8 Support.

If you need to open a file whose name starts with ‘--’, you can put ‘--’ before the filename, which will skip command recognition for the next word.

You can use I/O redirection to pipe the output of other commands into your first document. For example,

  ls -l | ne file1.txt --read-only file2.txt

will open three documents: an unnamed document containing the output of the ls -l command, the contents of file1.txt, and the contents of file2.txt with the read-only flag set.

It’s possible to apply the --binary, --read-only, and +N,M options to the piped unnamed document by referencing it as a single -. Only the first such file name will reference the piped document (even if it isn’t the first file name on the command line). Subsequent dashes will be considered normal file names. If you want the first dash to be treated like a normal file instead of a reference to the piped document, prefix the dash with ‘--’. Consider these two command lines:

  ls -l | ne --read-only +3,8 - file1.txt -
  ls -l | ne file1.txt -- - --read-only +3,8 -
  ls -l | ne --binary file1.txt --read-only -- -

All three of these commands open ne with three documents: the output of the ls -l command will be in the first unnamed document, the contents of file1.txt will be in the second document, while the third document will contain the contents of the file - (or an empty document with that name if there is no such file). The first and second commands do exactly the same thing: the unnamed first document is marked read-only and the cursor is positioned on line 3 column 8, while the other two document are opened normally. In the case of the third command, file1.txt is opened in binary mode, the document named - is marked read-only, while the first, unnamed, document—which is not referenced on the command line—with the output from ls -l is opened normally.

Finally, ne has a global directory where the system administrator can store macros, default preferences, and syntax definitions for all users of the system. The location of this directory is defined when ne is built, but you can override it by creating and exporting the NE_GLOBAL_DIR environment variable prior to invoking ne. If you load no files when you start ne, or if you invoke the About command, it will display a splash screen. The last line on that screen shows the global directory ne is using, if it exists, or an error message otherwise.


Next: , Up: Reference   [Contents][Index]