NEdit-ng can be operated on its own, or as a two-part client/server application. Client/server mode is useful for integrating NEdit-ng with software development environments, mailers, and other programs; or just as a quick way to open files from the shell command line without starting a new NEdit-ng session.

To run NEdit-ng in server mode, type:

nedit-ng -server

NEdit-ng can also be started in server mode via the NEdit-ng Client program (nc-ng) when no servers are available.

The nc-ng program, which is distributed along with NEdit-ng, sends commands to an NEdit-ng server to open files or execute editor actions. It can also be used on files that are already opened.

Listing a file on the nc-ng command line means: Open it if it is not already open and bring the window to the front.

nc-ng supports the following command line options:

nc-ng [-read] [-create]
   [-line n | +n] [-do command] [-lm languagemode]
   [-svrname name] [-svrcmd command]
   [-ask] [-noask] [-timeout seconds]
   [-geometry geometry | -g geometry] [-icon | -iconic]
   [-tabbed] [-untabbed] [-group] [-wait]
   [-V | -version]
   [--] [file...]
  • -read
    Open the file read-only regardless of its actual permissions. There is no effect if the file is already open.

  • -create
    Don't warn about file creation when a file doesn't exist.

  • -line n, +n
    Go to line number n. This will also affect files which are already open.

  • -do command
    Execute an NEdit-ng macro or action on the file following the -do argument on the command line.

    If you use this command without a filename, nc-ng would randomly choose one window to focus and execute the macro in.

  • -lm languagemode
    Initial language mode used.

  • -svrname name
    Explicitly instructs nc-ng which server to connect to, an instance of nedit-ng with a corresponding -svrname argument. By naming servers, you can run several simultaneously, and direct files and commands specifically to any one.

  • -svrcmd command
    The command which nc-ng uses to start an NEdit-ng server. Defaults to nedit-ng -server.

  • -ask, -noask
    Instructs nc-ng to automatically start a server if one is not available.

  • -timeout seconds
    Basic time-out period used in communication with an NEdit-ng server. The default is 10 seconds.

    Under rare conditions (such as a slow connection), it may be necessary to increase the time-out period. In most cases, the default is fine.

  • -geometry geometry, -g geometry
    The initial size and/or location of editor windows. See NEdit-ng Command Line for details.

  • -icon, -iconic
    Initial window state.

  • -tabbed
    Open all subsequent files in new tabs. Resets -group option.

  • -untabbed
    Open all subsequent files in new windows. Resets -group option.

  • -group
    Open all subsequent files as tabs in a new window.

  • -wait
    Instructs nc-ng not to return to the shell until all files given are closed.

    Normally, nc-ng returns once the files given in its command line are opened by the server. When this option is given, nc-ng returns only after the last file given in this call is closed.

    Note that this option affects all files in the command line, not only the ones following this option.

    Note that nc-ng will wait for all files given in the command line, even if the files were already opened.

  • -version, -V
    Prints nc-ng's version and build information.

Command Line Arguments

In typical Unix style, arguments affect the files which follow them on the command line, for example:

Incorrect: nc-ng file.c -line 25
Correct: nc-ng -line 25 file.c

-read, -create, and -line affect all of the files which follow them on the command line.

The -do macro is executed only once, on the next file on the line. -do without a file following it on the command line, executes the macro on the first available window (presumably when you give a -do command without a corresponding file or window, you intend it to do something independent of the window in which it happens to execute).

The -wait option affects all files named in the command line.

Multiple Servers

Sometimes it is useful to have more than one NEdit-ng server running, for example to keep mail and programming work separate. The option, -svrname, to both nedit-ng and nc-ng, allows you to start, and communicate with, separate named servers. A named server responds only to requests with the corresponding -svrname argument.

Communication

Communication between nc-ng and nedit-ng is done through a local socket. nc-ng uses the DISPLAY environment variable, the machine name and your user name to find the appropriate server.

The command which nc-ng uses to start an NEdit-ng server is settable using the -svrCommand argument, by default nedit-ng -server.