2003-01-20 16:58:36 +03:00
|
|
|
.TH MCEDIT 1 "January 2003" "MC Version 4.6.0" "GNU Midnight Commander"
|
1998-02-27 07:54:42 +03:00
|
|
|
.SH NAME
|
2003-01-19 20:47:50 +03:00
|
|
|
mcedit \- Internal file viewer of GNU Midnight Commander.
|
1998-02-27 07:54:42 +03:00
|
|
|
.SH USAGE
|
|
|
|
.B mcedit
|
2003-01-19 20:47:50 +03:00
|
|
|
[\-bcCdfhstVx?] [+number] file
|
1998-02-27 07:54:42 +03:00
|
|
|
.SH DESCRIPTION
|
|
|
|
.LP
|
2003-01-19 20:47:50 +03:00
|
|
|
mcedit is a link to
|
|
|
|
.BR mc ,
|
|
|
|
the main GNU Midnight Commander executable. Executing GNU Midnight
|
|
|
|
Commander under this name requests staring the internal editor and
|
|
|
|
opening the
|
|
|
|
.I file
|
|
|
|
specified on the command line. The editor is based on the terminal
|
|
|
|
version of
|
|
|
|
.B cooledit
|
|
|
|
\- standalone editor for X Window System.
|
1998-02-27 07:54:42 +03:00
|
|
|
.SH OPTIONS
|
|
|
|
.TP
|
2001-09-05 02:06:30 +04:00
|
|
|
.I "+number"
|
2003-01-20 16:58:36 +03:00
|
|
|
Go to the line specified by number (do not put a space between the
|
|
|
|
.I "+"
|
|
|
|
sign and the number).
|
1999-12-09 01:15:13 +03:00
|
|
|
.TP
|
1998-02-27 07:54:42 +03:00
|
|
|
.I "\-b"
|
2003-01-19 20:47:50 +03:00
|
|
|
Force black and white display.
|
1998-02-27 07:54:42 +03:00
|
|
|
.TP
|
|
|
|
.I "\-c"
|
2003-01-28 23:03:11 +03:00
|
|
|
Force ANSI color mode on terminals that don't seem to have color
|
|
|
|
support.
|
1998-02-27 07:54:42 +03:00
|
|
|
.TP
|
|
|
|
.I "\-C <keyword>=<FGcolor>,<BGcolor>:<keyword>= ..."
|
2003-01-19 20:47:50 +03:00
|
|
|
Specify a different color set. See the
|
|
|
|
.B Colors
|
|
|
|
section in mc(1) for more information.
|
1998-02-27 07:54:42 +03:00
|
|
|
.TP
|
|
|
|
.I "\-d"
|
2003-01-19 20:47:50 +03:00
|
|
|
Disable mouse support.
|
1998-02-27 07:54:42 +03:00
|
|
|
.TP
|
|
|
|
.I "\-f"
|
2003-01-20 16:58:36 +03:00
|
|
|
Display the compiled-in search path for GNU Midnight Commander data
|
|
|
|
files.
|
1998-02-27 07:54:42 +03:00
|
|
|
.TP
|
|
|
|
.I "\-t"
|
2003-01-28 23:03:11 +03:00
|
|
|
Force using termcap database instead of terminfo. This option is only
|
|
|
|
applicable if GNU Midnight Commander was compiled with S-Lang library
|
|
|
|
with terminfo support.
|
1998-02-27 07:54:42 +03:00
|
|
|
.TP
|
|
|
|
.I "\-V"
|
2003-01-19 20:47:50 +03:00
|
|
|
Display the version of the program.
|
1998-02-27 07:54:42 +03:00
|
|
|
.TP
|
|
|
|
.I "\-x"
|
2003-01-20 16:58:36 +03:00
|
|
|
Force xterm mode. Used when running on xterm-capable terminals (two
|
1998-02-27 07:54:42 +03:00
|
|
|
screen modes, and able to send mouse escape sequences).
|
2003-01-19 20:47:50 +03:00
|
|
|
.SH FEATURES
|
2003-01-28 23:03:11 +03:00
|
|
|
The internal file editor is a full-featured full screen editor. It can
|
|
|
|
edit files up to 64 megabytes. It is possible to edit binary files.
|
|
|
|
The features it presently supports are: block copy, move, delete, cut,
|
|
|
|
paste; key for key undo; pull-down menus; file insertion; macro
|
|
|
|
commands; regular expression search and replace (and our own
|
|
|
|
scanf-printf search and replace); shift-arrow text highlighting (if
|
|
|
|
supported by the terminal); insert-overwrite toggle; word wrap;
|
|
|
|
autoindent; tunable tab size; syntax highlighting for various file
|
|
|
|
types; and an option to pipe text blocks through shell commands like
|
|
|
|
indent and ispell.
|
2003-01-19 20:47:50 +03:00
|
|
|
.SH KEYS
|
2003-01-28 23:03:11 +03:00
|
|
|
The editor is easy to use and can be used without learning. The
|
|
|
|
pull-down menu is invoked by pressing F9. You can learn other keys from
|
|
|
|
the menu and from the buttor bar labels.
|
|
|
|
.PP
|
|
|
|
In addition to that, Shift combined with arrows does text highlighting
|
|
|
|
(if supported by the terminal):
|
2003-01-19 20:47:50 +03:00
|
|
|
.B Ctrl-Ins
|
|
|
|
copies to the file
|
|
|
|
.BR ~/.mc/cedit/cooledit.clip ,
|
|
|
|
.B Shift-Ins
|
|
|
|
pastes from
|
2003-01-28 23:03:11 +03:00
|
|
|
.BR ~/.mc/cedit/cooledit.clip ,
|
2003-01-19 20:47:50 +03:00
|
|
|
.B Shift-Del
|
|
|
|
cuts to
|
|
|
|
.BR ~/.mc/cedit/cooledit.clip ,
|
|
|
|
and
|
|
|
|
.B Ctrl-Del
|
2003-01-28 23:03:11 +03:00
|
|
|
deletes highlighted text. Mouse highlighting also works on some
|
|
|
|
terminals. To use the standard mouse support provided by your terminal,
|
|
|
|
hold the Shift key. Don't forget that the mouse support in the terminal
|
|
|
|
doesn't share the clipoard with
|
|
|
|
.BR mcedit .
|
2002-09-20 19:42:46 +04:00
|
|
|
.PP
|
|
|
|
The completion key (usually
|
|
|
|
.B "Alt-Tab"
|
|
|
|
or
|
2003-01-28 23:03:11 +03:00
|
|
|
.BR "Escape Tab" )
|
2002-09-20 19:42:46 +04:00
|
|
|
completes the word under the cursor using the words used earlier in the
|
|
|
|
file.
|
|
|
|
.PP
|
2003-01-19 20:47:50 +03:00
|
|
|
To define a macro, press
|
|
|
|
.B Ctrl-R
|
2003-01-28 23:03:11 +03:00
|
|
|
and then type out the keys you want to be executed. Press
|
2003-01-19 20:47:50 +03:00
|
|
|
.B Ctrl-R
|
|
|
|
again when finished. You can then assign the macro to any key you like
|
|
|
|
by pressing that key. The macro is executed when you press
|
|
|
|
.B Ctrl-A
|
|
|
|
and then the assigned key. The macro is also executed if you press
|
|
|
|
Meta, Ctrl, or Esc and the assigned key, provided that the key is not
|
2003-01-28 23:03:11 +03:00
|
|
|
used for any other function. The macro commands are stored in the file
|
2003-01-19 20:47:50 +03:00
|
|
|
.BR ~/.mc/cedit/cooledit.macros .
|
2001-09-16 03:16:20 +04:00
|
|
|
Do NOT edit this file if you are going to use macros again in the same
|
|
|
|
editing session, because
|
2003-01-19 20:47:50 +03:00
|
|
|
.B mcedit
|
|
|
|
caches macro key defines in memory.
|
|
|
|
.B mcedit
|
1998-02-27 07:54:42 +03:00
|
|
|
now overwrites a macro if a macro with the same key already exists,
|
|
|
|
so you won't have to edit this file. You will also have to restart
|
|
|
|
other running editors for macros to take effect.
|
2002-09-30 21:49:29 +04:00
|
|
|
.P
|
2003-01-19 20:47:50 +03:00
|
|
|
.B F19
|
2002-09-30 21:49:29 +04:00
|
|
|
will format C, C++, Java or HTML code when it is highlighted. An executable
|
2003-01-19 20:47:50 +03:00
|
|
|
file called
|
|
|
|
.B ~/.mc/cedit/edit.indent.rc
|
2001-09-16 03:16:20 +04:00
|
|
|
will be created for you from the default template. Feel free to edit it
|
|
|
|
if you need.
|
1998-02-27 07:54:42 +03:00
|
|
|
.PP
|
2003-01-19 20:47:50 +03:00
|
|
|
.B C-p
|
2001-09-16 03:16:20 +04:00
|
|
|
will run ispell on a block of text in a similar way. The script file
|
|
|
|
will be called
|
2003-01-19 20:47:50 +03:00
|
|
|
.BR ~/.mc/cedit/edit.spell.rc .
|
1998-02-27 07:54:42 +03:00
|
|
|
.PP
|
2003-01-28 23:03:11 +03:00
|
|
|
If some keys don't work, you can use
|
|
|
|
.B Learn Keys
|
|
|
|
in the
|
|
|
|
.B Options
|
|
|
|
menu.
|
1998-04-24 19:18:08 +04:00
|
|
|
.SH SYNTAX HIGHLIGHTING
|
2003-01-20 16:58:36 +03:00
|
|
|
.B mcedit
|
2003-01-19 20:47:50 +03:00
|
|
|
supports syntax highlighting. This means that keywords and contexts
|
|
|
|
(like C comments, string constants, etc) are highlighted in different
|
|
|
|
colors. The following section explains the format of the file
|
|
|
|
.BR ~/.mc/cedit/Syntax .
|
|
|
|
The file
|
|
|
|
.B ~/.mc/cedit/Syntax
|
|
|
|
is rescanned on opening of a any new editor file. The file contains
|
|
|
|
rules for highlighting, each of which is given on a separate line, and
|
2003-01-28 23:03:11 +03:00
|
|
|
define which keywords will be highlighted to what color.
|
|
|
|
.PP
|
|
|
|
The file is divided into sections, each beginning with a line with the
|
2003-01-19 20:47:50 +03:00
|
|
|
.B file
|
2003-01-28 23:03:11 +03:00
|
|
|
command. The sections are normally put into separate files using the
|
|
|
|
.B include
|
|
|
|
command.
|
2003-01-19 20:47:50 +03:00
|
|
|
.PP
|
2003-01-28 23:03:11 +03:00
|
|
|
The
|
|
|
|
.B file
|
|
|
|
command has three arguments. The first argument is a regular expression
|
|
|
|
that is applied to the file name to determine if the following section
|
|
|
|
applies to the file. The second argument is the description of the file
|
|
|
|
type. It is used in
|
|
|
|
.BR cooledit ;
|
|
|
|
future versions of
|
|
|
|
.B mcedit
|
|
|
|
may use it as well. The third optional argument is a regular expression
|
|
|
|
to match the first line of text of the file. The rules in the following
|
|
|
|
section apply if either the file name or the first line of text matches.
|
|
|
|
.PP
|
|
|
|
A section ends with the start of another section. Each section is
|
|
|
|
divided into contexts, and each context contains rules. A context is a
|
|
|
|
scope within the text that a particular set of rules belongs to. For
|
|
|
|
instance, the text within a C style comment (i.e. between
|
2003-01-19 20:47:50 +03:00
|
|
|
.B /*
|
|
|
|
and
|
|
|
|
.BR */ )
|
2003-01-28 23:03:11 +03:00
|
|
|
has its own color. This is a context, although it has no further rules
|
|
|
|
inside it because there is probably nothing that we want highlighted
|
|
|
|
within a C comment.
|
2003-01-19 20:47:50 +03:00
|
|
|
.PP
|
1998-04-24 19:18:08 +04:00
|
|
|
A trivial C programming section might look like this:
|
|
|
|
.PP
|
|
|
|
.nf
|
1998-12-11 01:14:10 +03:00
|
|
|
file .\\*\\\\.c C\\sProgram\\sFile (#include|/\\\\\\*)
|
1998-04-24 19:18:08 +04:00
|
|
|
|
|
|
|
wholechars abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_
|
|
|
|
|
|
|
|
# default colors
|
|
|
|
context default
|
1998-12-11 01:14:10 +03:00
|
|
|
keyword whole if 24
|
|
|
|
keyword whole else 24
|
|
|
|
keyword whole for 24
|
|
|
|
keyword whole while 24
|
|
|
|
keyword whole do 24
|
|
|
|
keyword whole switch 24
|
|
|
|
keyword whole case 24
|
|
|
|
keyword whole static 24
|
|
|
|
keyword whole extern 24
|
|
|
|
keyword { 14
|
|
|
|
keyword } 14
|
2003-01-19 20:47:50 +03:00
|
|
|
keyword '*' 6
|
1998-04-24 19:18:08 +04:00
|
|
|
|
|
|
|
# C comments
|
1998-12-11 01:14:10 +03:00
|
|
|
context /\\* \\*/ 22
|
1998-04-24 19:18:08 +04:00
|
|
|
|
|
|
|
# C preprocessor directives
|
1998-12-11 01:14:10 +03:00
|
|
|
context linestart # \\n 18
|
|
|
|
keyword \\\\\\n 24
|
1998-04-24 19:18:08 +04:00
|
|
|
|
|
|
|
# C string constants
|
1998-12-11 01:14:10 +03:00
|
|
|
context " " 6
|
|
|
|
keyword %d 24
|
|
|
|
keyword %s 24
|
|
|
|
keyword %c 24
|
|
|
|
keyword \\\\" 24
|
1998-04-24 19:18:08 +04:00
|
|
|
.fi
|
|
|
|
.PP
|
|
|
|
Each context starts with a line of the form:
|
|
|
|
.br
|
2003-01-20 16:58:36 +03:00
|
|
|
.B context
|
|
|
|
.RB [ exclusive ]
|
|
|
|
.RB [ whole | wholeright | wholeleft ]
|
|
|
|
.RB [ linestart ]
|
|
|
|
.I delim
|
|
|
|
.RB [ linestart ]
|
|
|
|
.I delim
|
|
|
|
.RI [ foreground ]
|
|
|
|
.RI [ background ]
|
1998-04-24 19:18:08 +04:00
|
|
|
.br
|
|
|
|
One exception is the first context. It must start with the command
|
|
|
|
.br
|
2003-01-20 16:58:36 +03:00
|
|
|
.B context
|
|
|
|
.B default
|
|
|
|
.RI [ foreground ]
|
|
|
|
.RI [ background ]
|
1998-04-24 19:18:08 +04:00
|
|
|
.br
|
2003-01-20 16:58:36 +03:00
|
|
|
or else
|
|
|
|
.B mcedit
|
|
|
|
will report an error. The
|
|
|
|
.B linestart
|
|
|
|
option dictates that
|
|
|
|
.I delim
|
|
|
|
must start at the beginning of a line. The
|
|
|
|
.B whole
|
|
|
|
option tells that delim must be a whole word. What constitutes a whole
|
|
|
|
word are a set of characters that can be changed at any point in the
|
|
|
|
file with the
|
|
|
|
.B wholechars
|
|
|
|
command. The
|
|
|
|
.B wholechars
|
|
|
|
command at the top just sets the set exactly to its default and could
|
|
|
|
therefore have been omitted. To specify that a word must be whole on the
|
|
|
|
left only, you can use the
|
|
|
|
.B wholeleft
|
|
|
|
option, and similarly on the right. The left and right set of characters
|
|
|
|
can be set separately with,
|
1998-04-24 19:18:08 +04:00
|
|
|
.br
|
2003-01-20 16:58:36 +03:00
|
|
|
.B wholechars
|
|
|
|
.RB [ left | right ]
|
|
|
|
.I characters
|
|
|
|
.PP
|
|
|
|
The
|
|
|
|
.B exclusive
|
|
|
|
option causes the text between the delimiters to be highlighted, but not
|
|
|
|
the delimiters themselves.
|
|
|
|
.PP
|
1998-04-24 19:18:08 +04:00
|
|
|
Each rule is a line of the form:
|
|
|
|
.br
|
2003-01-20 16:58:36 +03:00
|
|
|
.B keyword
|
|
|
|
.RB [ whole | wholeright | wholeleft ]
|
|
|
|
.RB [ linestart ]
|
|
|
|
.I string
|
|
|
|
.I foreground
|
|
|
|
.RI [ background ]
|
1998-04-24 19:18:08 +04:00
|
|
|
.br
|
2001-09-03 22:01:45 +04:00
|
|
|
Context or keyword strings are interpreted, so that you can include
|
|
|
|
tabs and spaces with the sequences \\t and \\s. Newlines and the \\ are
|
|
|
|
specified with \\n and \\\\ respectively. Since whitespace is used as a
|
|
|
|
separator, it may not be used as is. Also, \\* must be used to specify
|
|
|
|
a *. The * itself is a wildcard that matches any length of characters.
|
|
|
|
For example,
|
1998-04-24 19:18:08 +04:00
|
|
|
.nf
|
2003-01-19 20:47:50 +03:00
|
|
|
keyword '*' 6
|
1998-04-24 19:18:08 +04:00
|
|
|
.fi
|
2001-09-03 22:01:45 +04:00
|
|
|
colors all C single character constants green. You could also have
|
1998-04-24 19:18:08 +04:00
|
|
|
used
|
|
|
|
.nf
|
2003-01-19 20:47:50 +03:00
|
|
|
keyword "*" 6
|
1998-04-24 19:18:08 +04:00
|
|
|
.fi
|
2001-09-03 22:01:45 +04:00
|
|
|
to color string constants, except that the matched string may not cross
|
2003-01-20 16:58:36 +03:00
|
|
|
newlines. The wildcard may be used within context delimiters as well,
|
|
|
|
but you cannot have a wildcard as the last or first character.
|
|
|
|
.PP
|
1998-04-24 19:18:08 +04:00
|
|
|
Important to note is the line
|
|
|
|
.nf
|
1998-12-11 01:14:10 +03:00
|
|
|
keyword \\\\\\n 24
|
1998-04-24 19:18:08 +04:00
|
|
|
.fi
|
2003-01-20 16:58:36 +03:00
|
|
|
.PP
|
1998-04-24 19:18:08 +04:00
|
|
|
This line defines a keyword containing the \\ and newline characters.
|
2003-01-20 16:58:36 +03:00
|
|
|
Since the keywords have a higher precedence than the context delimiters,
|
|
|
|
this keyword prevents the context from ending at the end of the line if
|
|
|
|
the line ends in a \\ thus allowing C preprocessor directive to continue
|
1998-04-24 19:18:08 +04:00
|
|
|
across multiple lines.
|
2003-01-19 20:47:50 +03:00
|
|
|
.PP
|
2003-01-20 16:58:36 +03:00
|
|
|
The possible colors are: black, gray, red, brightred, green,
|
|
|
|
brightgreen, brown, yellow, blue, brightblue, magenta, brightmagenta,
|
|
|
|
cyan, brightcyan, lightgray and white.
|
2003-01-19 20:47:50 +03:00
|
|
|
.PP
|
2003-01-20 16:58:36 +03:00
|
|
|
Comments may be put on a separate line starting with the hash sign (#).
|
2003-01-19 20:47:50 +03:00
|
|
|
.PP
|
1998-04-24 19:18:08 +04:00
|
|
|
Because of the simplicity of the implementation, there are a few
|
2003-01-20 16:58:36 +03:00
|
|
|
intricacies that will not be dealt with correctly but these are a minor
|
|
|
|
irritation. On the whole, a broad spectrum of quite complicated
|
|
|
|
situations are handled with these simple rules. It is a good idea to
|
1998-04-24 19:18:08 +04:00
|
|
|
take a look at the syntax file to see some of the nifty tricks you can
|
2003-01-20 16:58:36 +03:00
|
|
|
do with a little imagination. If you can't get by with the rules I have
|
1998-12-11 01:14:10 +03:00
|
|
|
coded, and you think you have a rule that would be useful, please email
|
2003-01-20 16:58:36 +03:00
|
|
|
me with your request. However, do not ask for regular expression
|
1998-12-11 01:14:10 +03:00
|
|
|
support, because this is flatly impossible.
|
2003-01-19 20:47:50 +03:00
|
|
|
.PP
|
2003-01-20 16:58:36 +03:00
|
|
|
A useful hint is to work with as much as possible with the things you
|
|
|
|
can do rather than try to do things that this implementation can't deal
|
|
|
|
with. Also remember that the aim of syntax highlighting is to make
|
|
|
|
programming less prone to error, not to make code look pretty.
|
1998-12-11 01:14:10 +03:00
|
|
|
.SH COLORS
|
|
|
|
The default colors may be changed by appending to the
|
2003-01-20 16:58:36 +03:00
|
|
|
.B MC_COLOR_TABLE
|
|
|
|
environment variable. Foreground and background colors pairs may be
|
|
|
|
specified for example with:
|
1998-12-11 01:14:10 +03:00
|
|
|
.PP
|
|
|
|
.nf
|
2001-09-20 05:42:57 +04:00
|
|
|
MC_COLOR_TABLE="$MC_COLOR_TABLE:\\
|
|
|
|
editnormal=lightgray,black:\\
|
|
|
|
editbold=yellow,black:\\
|
1998-12-11 01:14:10 +03:00
|
|
|
editmarked=black,cyan"
|
|
|
|
.fi
|
1998-02-27 07:54:42 +03:00
|
|
|
.SH OPTIONS
|
1998-04-24 19:18:08 +04:00
|
|
|
Most options can now be set from the editors options dialog
|
2003-01-20 16:58:36 +03:00
|
|
|
box. See the
|
|
|
|
.B Options
|
|
|
|
menu. The following options are defined in
|
|
|
|
.B ~/.mc/ini
|
|
|
|
and have obvious counterparts in the dialog box. You can modify them to
|
|
|
|
change the editor behavior, by editing the file. Unless specified, a 1
|
|
|
|
sets the option to on, and a 0 sets it to off, as is usual.
|
1998-02-27 07:54:42 +03:00
|
|
|
.TP
|
|
|
|
.I use_internal_edit
|
2003-01-19 20:47:50 +03:00
|
|
|
This option is ignored when invoking
|
2003-01-20 16:58:36 +03:00
|
|
|
.BR mcedit .
|
1998-02-27 07:54:42 +03:00
|
|
|
.TP
|
|
|
|
.I editor_key_emulation
|
2003-01-19 20:47:50 +03:00
|
|
|
1 for
|
|
|
|
.B Emacs
|
|
|
|
keys, and 0 for normal
|
|
|
|
.B Cooledit
|
1998-02-27 07:54:42 +03:00
|
|
|
keys.
|
|
|
|
.TP
|
|
|
|
.I editor_tab_spacing
|
|
|
|
Interpret the tab character as being of this length.
|
|
|
|
Default is 8. You should avoid using
|
|
|
|
other than 8 since most other editors and text viewers
|
2003-01-19 20:47:50 +03:00
|
|
|
assume a tab spacing of 8. Use
|
|
|
|
.B editor_fake_half_tabs
|
1998-02-27 07:54:42 +03:00
|
|
|
to simulate a smaller tab spacing.
|
|
|
|
.TP
|
|
|
|
.I editor_fill_tabs_with_spaces
|
|
|
|
Never insert a tab space. Rather insert spaces (ascii 20h) to fill to the
|
|
|
|
desired tab size.
|
|
|
|
.TP
|
|
|
|
.I editor_return_does_auto_indent
|
|
|
|
Pressing return will tab across to match the indentation
|
|
|
|
of the first line above that has text on it.
|
|
|
|
.TP
|
|
|
|
.I editor_backspace_through_tabs
|
|
|
|
Make a single backspace delete all the space to the left
|
|
|
|
margin if there is no text between the cursor and the left
|
|
|
|
margin.
|
|
|
|
.TP
|
|
|
|
.I editor_fake_half_tabs
|
|
|
|
This will emulate a half tab for those who want to program
|
|
|
|
with a tab spacing of 4, but do not want the tab size changed
|
|
|
|
from 8 (so that the code will be formatted the same when displayed
|
2003-01-19 20:47:50 +03:00
|
|
|
by other programs). When editing between text and the left
|
1998-02-27 07:54:42 +03:00
|
|
|
margin, moving and tabbing will be as though a tab space were
|
|
|
|
4, while actually using spaces and normal tabs for an optimal fill.
|
|
|
|
When editing anywhere else, a normal tab is inserted.
|
|
|
|
.TP
|
|
|
|
.I editor_option_save_mode
|
2003-01-20 16:58:36 +03:00
|
|
|
Possible values 0, 1 and 2. The save mode (see the options menu also)
|
|
|
|
allows you to change the method of saving a file. Quick save (0) saves
|
|
|
|
the file by immediately, truncating the disk file to zero length (i.e.
|
|
|
|
erasing it) and the writing the editor contents to the file. This
|
|
|
|
method is fast, but dangerous, since a system error during a file save
|
|
|
|
will leave the file only partially written, possibly rendering the data
|
|
|
|
irretrievable. When saving, the safe save (1) option enables creation
|
|
|
|
of a temporary file into which the file contents are first written. In
|
|
|
|
the event of an problem, the original file is untouched. When the
|
|
|
|
temporary file is successfully written, it is renamed to the name of the
|
|
|
|
original file, thus replacing it. The safest method is create backups
|
|
|
|
(2). Where a backup file is created before any changes are made. You
|
|
|
|
can specify your own backup file extension in the dialog. Note that
|
|
|
|
saving twice will replace your backup as well as your original file.
|
2003-01-19 20:47:50 +03:00
|
|
|
.SH MISCELLANEOUS
|
|
|
|
You can use scanf search and replace to search and replace a C format
|
2003-01-20 16:58:36 +03:00
|
|
|
string. First take a look at the
|
2003-01-19 20:47:50 +03:00
|
|
|
.B sscanf
|
|
|
|
and
|
|
|
|
.B sprintf
|
|
|
|
man pages to see what a format string is and how it works. Here's an
|
|
|
|
example: suppose that you want to replace all occurrences of an open
|
|
|
|
bracket, three comma separated numbers, and a close bracket, with the
|
|
|
|
word
|
|
|
|
.IR apples ,
|
|
|
|
the third number, the word
|
1998-02-27 07:54:42 +03:00
|
|
|
.I oranges
|
2003-01-19 20:47:50 +03:00
|
|
|
and then the second number. You would fill in the Replace dialog box as
|
|
|
|
follows:
|
|
|
|
.PP
|
1998-02-27 07:54:42 +03:00
|
|
|
.nf
|
|
|
|
.B Enter search string
|
|
|
|
(%d,%d,%d)
|
|
|
|
.B Enter replace string
|
|
|
|
apples %d oranges %d
|
|
|
|
.B Enter replacement argument order
|
|
|
|
3,2
|
|
|
|
.fi
|
2003-01-19 20:47:50 +03:00
|
|
|
.PP
|
|
|
|
The last line specifies that the third and then the second number are to
|
|
|
|
be used in place of the first and second.
|
|
|
|
.PP
|
1998-02-27 07:54:42 +03:00
|
|
|
It is advisable to use this feature with Prompt On Replace on, because
|
|
|
|
a match is thought to be found whenever the number of arguments found
|
|
|
|
matches the number given, which is not always a real match. Scanf also
|
|
|
|
treats whitespace as being elastic. Note that the scanf format %[ is
|
|
|
|
very useful for scanning strings, and whitespace.
|
2003-01-19 20:47:50 +03:00
|
|
|
.PP
|
1998-02-27 07:54:42 +03:00
|
|
|
The editor also displays non-us characters (160+). When editing
|
2003-01-19 20:47:50 +03:00
|
|
|
binary files, you should set
|
|
|
|
.B display bits
|
1998-02-27 07:54:42 +03:00
|
|
|
to 7 bits in the Midnight Commander options menu to keep the
|
|
|
|
spacing clean.
|
|
|
|
.SH FILES
|
2003-01-20 16:58:36 +03:00
|
|
|
.I @prefix@/share/mc/mc.hlp
|
1998-02-27 07:54:42 +03:00
|
|
|
.IP
|
|
|
|
The help file for the program.
|
|
|
|
.PP
|
2003-01-19 20:47:50 +03:00
|
|
|
.I @prefix@/share/mc/mc.ini
|
1998-02-27 07:54:42 +03:00
|
|
|
.IP
|
2003-01-19 20:47:50 +03:00
|
|
|
The default system-wide setup for GNU Midnight Commander, used only if
|
|
|
|
the user's own ~/.mc/ini file is missing.
|
1998-02-27 07:54:42 +03:00
|
|
|
.PP
|
2003-01-19 20:47:50 +03:00
|
|
|
.I @prefix@/share/mc/mc.lib
|
|
|
|
.IP
|
|
|
|
Global settings for the Midnight Commander. Settings in this file
|
|
|
|
affect all users, whether they have ~/.mc/ini or not.
|
|
|
|
.PP
|
2003-01-20 16:58:36 +03:00
|
|
|
.I $HOME/.mc/ini
|
1998-02-27 07:54:42 +03:00
|
|
|
.IP
|
2003-01-19 20:47:50 +03:00
|
|
|
User's own setup. If this file is present, the setup is loaded from
|
|
|
|
here instead of the system-wide startup file.
|
1998-02-27 07:54:42 +03:00
|
|
|
.PP
|
2003-01-20 16:58:36 +03:00
|
|
|
.I $HOME/.mc/ini
|
1998-02-27 07:54:42 +03:00
|
|
|
.IP
|
|
|
|
User's own setup. If this file is present then the setup is loaded
|
|
|
|
from here instead of the system-wide startup file.
|
|
|
|
.PP
|
2003-01-20 16:58:36 +03:00
|
|
|
.I $HOME/.mc/cedit/
|
1998-02-27 07:54:42 +03:00
|
|
|
.IP
|
|
|
|
User's own temporary directory where block commands are processed
|
|
|
|
and saved.
|
|
|
|
.SH LICENSE
|
|
|
|
This program is distributed under the terms of the GNU General Public
|
|
|
|
License as published by the Free Software Foundation. See the built-in
|
|
|
|
help of the Midnight Commander for details on the License and the lack
|
|
|
|
of warranty.
|
|
|
|
.SH AVAILABILITY
|
2003-01-19 20:47:50 +03:00
|
|
|
The latest version of this program can be found at
|
2003-01-19 20:10:58 +03:00
|
|
|
ftp://ftp.ibiblio.org/pub/Linux/utils/file/managers/mc/.
|
1998-02-27 07:54:42 +03:00
|
|
|
.SH SEE ALSO
|
|
|
|
cooledit(1), mc(1), gpm(1), terminfo(1), scanf(3).
|
|
|
|
.SH AUTHORS
|
1998-12-11 01:14:10 +03:00
|
|
|
Paul Sheer (psheer@obsidian.co.za) is the developer of
|
1998-02-27 07:54:42 +03:00
|
|
|
the Midnight Commander's internal editor.
|
|
|
|
.SH BUGS
|
2001-09-16 03:16:20 +04:00
|
|
|
Bugs should be reported to mc-devel@gnome.org
|