How to change the default editor.
The Miranda /e command (see manual page on command interpreter) invokes
an editor. By default this is the standard UNIX screen editor "vi". If
you don't like "vi", or would prefer to use another editor, this is
easily arranged.
The Miranda command
/editor
reports the editor currently in use by the Miranda system. To change it
to (for example) pico, just say
/editor pico
and the /e command and various other features of Miranda will now use
the pico editor instead. Alternatively, when next invoking the miranda
system from UNIX you can supply it with a flag requesting a specific
editor by name, as follows:
mira -editor pico ...
In either case it is only necessary to do this once, since the Miranda
system stores such information permanently. (It does this in a file
called ".mirarc" in your home directory - you should not remove or
tamper with this file).
You can select any editor that is installed on your system. If you are
unfamiliar with vi and haven't any other editor in mind, the editor pico
(if installed) is particularly easy to use (has instructions on screen).
Alternatives are nano (similar to pico) and joe. Another
easy-to-get-started-with editor, more sophisticated than either pico or
vi, is emacs.
More advanced information
The interface between the Miranda system and the editor needs a way of
telling the editor to open a file with the cursor positioned at a
specified line number. For example to make the editor `vi' open a file
at line 13, the UNIX command is
vi +13 file
the Miranda system has built in knowledge of this, so if the installed
editor is `vi' and the compiler has found a syntax error in the script,
the Miranda `/e' command will open the script at the line containing the
error.
To retain this ability when substituting another editor for `vi', you
must supply the `/editor' command with the template of a UNIX command
for invoking your editor at a given line number. In this template the
line number is represented by the character `!' and the filename by the
character `%'. For example the full template for `vi' would be supplied
to Miranda in the following way
/editor vi +! %
If the `%' character does not occur in your template, Miranda will
assume that the name of the file is to be added to the end of the
command, as its final argument. So the template for `vi' could equally
well be given as
/editor vi +!
the same formula works for pico. If the editor is one that starts up
its own window, separate from the Miranda session window (gnu emacs does
this), you will want to make the editor run as a concurrent process by
putting "&" at the end of the command, thus
/editor emacs +! % &
Note that in this case you must include % where the filename goes,
because adding it after the "&" would not make sense. In fact Miranda
has built in knowledge of vi, pico, nano, joe and emacs, so just naming
the editor will be enough in these cases.
If you install an editor without the capability to be opened at a
specified line number (i.e. you cannot give a template for it
containing the `!' character), the /e command loses its ability to "go
to the right place" after an error, and the `??' command will be
disabled (`??identifier' asks the Miranda system to open the relevant
source file at the definition of the given identifier.)
The Miranda system will work without either of these features, but there
is a significant loss of power in the user interface. If you intend
using the Miranda system regularly it is worthwhile to find an editor
with the required capability or to consider learning to use either vi or
emacs if you don't already know one of them.
If your installed editor lacks the `open at line number' feature, you
may find it convenient to have the script listed to the screen during
compilation (this feature of the compiler can be switched on and off by
the commands `/list', `/nolist'). As an assistance to naive users, the
Miranda system turns on `/list' for you if the `/editor' command is used
to install an editor without the `open at line number' feature.
[Pathological case:
"What do I do if the name of my editor contains a `!' or a `%'
character?" You escape it with a backslash, so if the name of the editor
is `oh!wonder!', to install it in Miranda you say
/editor oh\!wonder\!
end of pathological case]
Checking for source updates
If during a session changes have been made to any relevant source file,
the Miranda system automatically recompiles the current script and any
other scripts which it directly or indirectly `includes' and which have
been changed. At a minimum this check is performed after all /edit
commands and also after each shell escape.
A mode of operation possible on a windowing system is to keep an editor
window and Miranda session window both open. In this case more frequent
checking is appropriate and you should say /recheck (see 6 "Summary of
remaining commands"). This sets a flag which tells the Miranda
interpreter to recheck for source file updates before each interaction,
instead of only after /e and ! commands. But remember that you will
need to commit any edits to file before the `mira' session can see them.
As an assistance to naive users /recheck is automatically turned on if
/editor is used to install an editor command which includes "&", the
symbol used in the UNIX shell commands to spawn a concurrent process.
Say /norecheck to revert to the default behaviour.