1
1

Update description of syntax highlighting.

Этот коммит содержится в:
Pavel Roskin 2003-01-28 20:43:10 +00:00
родитель a6a2ed7eae
Коммит b3d0da2a30

Просмотреть файл

@ -67,7 +67,7 @@ indent and ispell.
.SH KEYS .SH KEYS
The editor is easy to use and can be used without learning. The 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 pull-down menu is invoked by pressing F9. You can learn other keys from
the menu and from the buttor bar labels. the menu and from the button bar labels.
.PP .PP
In addition to that, Shift combined with arrows does text highlighting In addition to that, Shift combined with arrows does text highlighting
(if supported by the terminal): (if supported by the terminal):
@ -84,8 +84,8 @@ and
.B Ctrl-Del .B Ctrl-Del
deletes highlighted text. Mouse highlighting also works on some deletes highlighted text. Mouse highlighting also works on some
terminals. To use the standard mouse support provided by your terminal, 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 hold the Shift key. Please note that the mouse support in the terminal
doesn't share the clipoard with doesn't share the clipboard with
.BR mcedit . .BR mcedit .
.PP .PP
The completion key (usually The completion key (usually
@ -183,36 +183,36 @@ wholechars abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_
# default colors # default colors
context default context default
keyword whole if 24 keyword whole if yellow
keyword whole else 24 keyword whole else yellow
keyword whole for 24 keyword whole for yellow
keyword whole while 24 keyword whole while yellow
keyword whole do 24 keyword whole do yellow
keyword whole switch 24 keyword whole switch yellow
keyword whole case 24 keyword whole case yellow
keyword whole static 24 keyword whole static yellow
keyword whole extern 24 keyword whole extern yellow
keyword { 14 keyword { brightcyan
keyword } 14 keyword } brightcyan
keyword '*' 6 keyword '*' green
# C comments # C comments
context /\\* \\*/ 22 context /\\* \\*/ brown
# C preprocessor directives # C preprocessor directives
context linestart # \\n 18 context linestart # \\n red
keyword \\\\\\n 24 keyword \\\\\\n brightred
# C string constants # C string constants
context " " 6 context " " green
keyword %d 24 keyword %d brightgreen
keyword %s 24 keyword %s brightgreen
keyword %c 24 keyword %c brightgreen
keyword \\\\" 24 keyword \\\\" brightgreen
.fi .fi
.PP .PP
Each context starts with a line of the form: Each context starts with a line of the form:
.br .PP
.B context .B context
.RB [ exclusive ] .RB [ exclusive ]
.RB [ whole | wholeright | wholeleft ] .RB [ whole | wholeright | wholeleft ]
@ -222,35 +222,36 @@ Each context starts with a line of the form:
.I delim .I delim
.RI [ foreground ] .RI [ foreground ]
.RI [ background ] .RI [ background ]
.br .PP
One exception is the first context. It must start with the command The first context is an exception. It must start with the command
.br .PP
.B context .B context
.B default .B default
.RI [ foreground ] .RI [ foreground ]
.RI [ background ] .RI [ background ]
.br .PP
or else otherwise
.B mcedit .B mcedit
will report an error. The will report an error. The
.B linestart .B linestart
option dictates that option specifies that
.I delim .I delim
must start at the beginning of a line. The must start at the beginning of a line. The
.B whole .B whole
option tells that delim must be a whole word. What constitutes a whole option tells that
word are a set of characters that can be changed at any point in the .I delim
file with the must be a whole word. To specify that a word must begin on the word
.B wholechars boundary only on the left side, you can use the
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 .B wholeleft
option, and similarly on the right. The left and right set of characters option, and similarly a word that must end on the word boundary is specified by
can be set separately with, .BR wholeright .
.br .PP
The set of characters that constitute a whole word can be changed at any
point in the file with the
.B wholechars
command. The left and right set of characters can be set separately
with
.PP
.B wholechars .B wholechars
.RB [ left | right ] .RB [ left | right ]
.I characters .I characters
@ -261,46 +262,67 @@ option causes the text between the delimiters to be highlighted, but not
the delimiters themselves. the delimiters themselves.
.PP .PP
Each rule is a line of the form: Each rule is a line of the form:
.br .PP
.B keyword .B keyword
.RB [ whole | wholeright | wholeleft ] .RB [ whole | wholeright | wholeleft ]
.RB [ linestart ] .RB [ linestart ]
.I string .I string
.I foreground .I foreground
.RI [ background ] .RI [ background ]
.br .PP
Context or keyword strings are interpreted, so that you can include Context or keyword strings are interpreted, so that you can include tabs
tabs and spaces with the sequences \\t and \\s. Newlines and the \\ are and spaces with the sequences \\t and \\s. Newlines and backslashes are
specified with \\n and \\\\ respectively. Since whitespace is used as a 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 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. an asterisk. The * itself is a wildcard that matches any length of
For example, characters. For example,
.PP
.nf .nf
keyword '*' 6 keyword '*' green
.fi .fi
colors all C single character constants green. You could also have .PP
used colors all C single character constants green. You also could use
.PP
.nf .nf
keyword "*" 6 keyword "*" green
.fi .fi
to color string constants, except that the matched string may not cross .PP
newlines. The wildcard may be used within context delimiters as well, to color string constants, but the matched string would not be allowed
but you cannot have a wildcard as the last or first character. to span across multiple newlines. The wildcard may be used within
context delimiters as well, but you cannot have a wildcard as the last
or first character.
.PP .PP
Important to note is the line Important to note is the line
.PP
.nf .nf
keyword \\\\\\n 24 keyword \\\\\\n brightgreen
.fi .fi
.PP .PP
This line defines a keyword containing the \\ and newline characters. This line defines a keyword containing the backslash and newline
Since the keywords have a higher precedence than the context delimiters, characters. Since the keywords are matched before the context
this keyword prevents the context from ending at the end of the line if delimiters, this keyword prevents the context from ending at the end of
the line ends in a \\ thus allowing C preprocessor directive to continue the lines that end in a backslash, thus allowing C preprocessor
across multiple lines. directive to continue across multiple lines.
.PP .PP
The possible colors are: black, gray, red, brightred, green, The possible colors are: black, gray, red, brightred, green,
brightgreen, brown, yellow, blue, brightblue, magenta, brightmagenta, brightgreen, brown, yellow, blue, brightblue, magenta, brightmagenta,
cyan, brightcyan, lightgray and white. cyan, brightcyan, lightgray and white. If the syntax file is shared
with
.BR cooledit ,
it is possible to specify different colors for
.B mcedit
and
.B cooledit
by separating them with a slash, e.g.
.PP
.nf
keyword #include red/Orange
.fi
.PP
.B mcedit
uses the color before the slash. See cooledit(1) for supported
.B cooledit
colors.
.PP .PP
Comments may be put on a separate line starting with the hash sign (#). Comments may be put on a separate line starting with the hash sign (#).
.PP .PP
@ -309,13 +331,13 @@ intricacies that will not be dealt with correctly but these are a minor
irritation. On the whole, a broad spectrum of quite complicated irritation. On the whole, a broad spectrum of quite complicated
situations are handled with these simple rules. It is a good idea to situations are handled with these simple rules. It is a good idea to
take a look at the syntax file to see some of the nifty tricks you can take a look at the syntax file to see some of the nifty tricks you can
do with a little imagination. If you can't get by with the rules I have do with a little imagination. If you cannot get by with the rules I
coded, and you think you have a rule that would be useful, please email have coded, and you think you have a rule that would be useful, please
me with your request. However, do not ask for regular expression email me with your request. However, do not ask for regular expression
support, because this is flatly impossible. support, because this is flatly impossible.
.PP .PP
A useful hint is to work with as much as possible with the things you 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 can do rather than try to do things that this implementation cannot deal
with. Also remember that the aim of syntax highlighting is to make with. Also remember that the aim of syntax highlighting is to make
programming less prone to error, not to make code look pretty. programming less prone to error, not to make code look pretty.
.SH COLORS .SH COLORS
@ -331,8 +353,8 @@ editbold=yellow,black:\\
editmarked=black,cyan" editmarked=black,cyan"
.fi .fi
.SH OPTIONS .SH OPTIONS
Most options can now be set from the editors options dialog Most options can now be set from the editors options dialog box. See
box. See the the
.B Options .B Options
menu. The following options are defined in menu. The following options are defined in
.B ~/.mc/ini .B ~/.mc/ini
@ -424,8 +446,8 @@ apples %d oranges %d
The last line specifies that the third and then the second number are to The last line specifies that the third and then the second number are to
be used in place of the first and second. be used in place of the first and second.
.PP .PP
It is advisable to use this feature with Prompt On Replace on, because It is advisable to use this feature with Prompt On Replace on, because a
a match is thought to be found whenever the number of arguments found 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 matches the number given, which is not always a real match. Scanf also
treats whitespace as being elastic. Note that the scanf format %[ is treats whitespace as being elastic. Note that the scanf format %[ is
very useful for scanning strings, and whitespace. very useful for scanning strings, and whitespace.
@ -433,8 +455,8 @@ very useful for scanning strings, and whitespace.
The editor also displays non-us characters (160+). When editing The editor also displays non-us characters (160+). When editing
binary files, you should set binary files, you should set
.B display bits .B display bits
to 7 bits in the Midnight Commander options menu to keep the to 7 bits in the Midnight Commander options menu to keep the spacing
spacing clean. clean.
.SH FILES .SH FILES
.I @prefix@/share/mc/mc.hlp .I @prefix@/share/mc/mc.hlp
.IP .IP
@ -475,7 +497,7 @@ ftp://ftp.ibiblio.org/pub/Linux/utils/file/managers/mc/.
.SH SEE ALSO .SH SEE ALSO
cooledit(1), mc(1), gpm(1), terminfo(1), scanf(3). cooledit(1), mc(1), gpm(1), terminfo(1), scanf(3).
.SH AUTHORS .SH AUTHORS
Paul Sheer (psheer@obsidian.co.za) is the developer of Paul Sheer (psheer@obsidian.co.za) is the original author of
the Midnight Commander's internal editor. the Midnight Commander's internal editor.
.SH BUGS .SH BUGS
Bugs should be reported to mc-devel@gnome.org Bugs should be reported to mc-devel@gnome.org