/usr/share/doc/ne/html/Syntax-Highlighting.html is in ne-doc 3.0.1-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
<head>
<title>ne’s manual: Syntax Highlighting</title>
<meta name="description" content="ne’s manual: Syntax Highlighting">
<meta name="keywords" content="ne’s manual: Syntax Highlighting">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
<link href="Command-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Reference.html#Reference" rel="up" title="Reference">
<link href="Menus.html#Menus" rel="next" title="Menus">
<link href="The-Requester.html#The-Requester" rel="prev" title="The Requester">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
div.smalllisp {margin-left: 3.2em}
kbd {font-style:oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:nowrap}
span.nolinebreak {white-space:nowrap}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="Syntax-Highlighting"></a>
<div class="header">
<p>
Next: <a href="Menus.html#Menus" accesskey="n" rel="next">Menus</a>, Previous: <a href="The-Requester.html#The-Requester" accesskey="p" rel="prev">The Requester</a>, Up: <a href="Reference.html#Reference" accesskey="u" rel="up">Reference</a> [<a href="Command-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Syntax-Highlighting-1"></a>
<h3 class="section">3.6 Syntax Highlighting</h3>
<a name="index-Syntax-Highlighting"></a>
<p>Syntax highlighting is particularly useful for programming language
text or other types of documents which have a strictly defined syntax.
Colors indicate different syntactic categories of text according to
the syntax definition in use.
</p>
<p>Syntax definitions are stored in separate files. <code>ne</code> comes with a
suite of syntax definitions for many popular programming languages.
When you load a file, <code>ne</code> selects the appropriate syntax
definition as determined by the filename extension in much the same way
autoprefs are loaded. It also contains a built-in table of common
filename extensions that share the same syntax definitions. For
example, both ‘<samp>cbl</samp>’, and ‘<samp>cob</samp>’ files use the ‘<samp>cobol</samp>’
definition. See the <a href="Syntax.html#Syntax">Syntax</a> command for the complete list of
built-in extension mappings.
</p>
<p>If there is no matching syntax definition for the filename extension,
or if the buffer you are editing has no filename yet, or you just want
to try a different syntax definition, you can load and use the
syntax definition of your choice with the <code>Syntax</code> command. It
takes the syntax name as a parameter. For example, the name “<code>c</code>”
works for C syntax files with extensions ‘<samp>.c</samp>’, ‘<samp>.h</samp>’,
‘<samp>c++</samp>’, etc. <code>ne</code> searches for the specified syntax definition
file in the ‘<samp>syntax</samp>’ subdirectory of your <samp>~/.ne</samp> directory
first. If not found there, <code>ne</code> then looks in the ‘<samp>syntax</samp>’
subdirectory of <code>ne</code>’s global directory for the syntax definition
file. See <a href="Arguments.html#Arguments">Arguments</a>.
</p>
<p>With no parameter, the <code>Syntax</code> command prompts you for a syntax
to load, the offered default being the currently loaded syntax if there is one.
Use the <tt class="key">Tab</tt> key at that prompt to get a list of available syntax
recognizers.
</p>
<p>One syntax definition you may find useful for any type of text file is
called simply ‘<samp>tabs</samp>’. It highlights the <small>TAB</small>s in your text so
you can distinguish them from regular spaces.
</p>
<p>You can create your own syntax definitions and store them in your
<samp>~/.ne/syntax</samp> directory (actually, modifying the colors of an
existing definition is much easier; see <a href="Hints-and-Tricks.html#Hints-and-Tricks">Hints and Tricks</a>). A complete
explanation of syntax specifications is beyond the scope of this document,
but the existing definition files should prove to be useful examples. In
particular, the <samp>syntax/c.jsf</samp> file contains some particularly
helpful comments. Syntax definition files have a ‘<samp>.jsf</samp>’ extension. Do
not include that extension when using the <code>Syntax</code> command.
</p>
<p>Your own syntax recognizers will be preferred over the global recognizers.
If you use the <tt class="key">Tab</tt> key at the syntax prompt to display the requester
of extant recognizers, yours will be marked with an asterisk and bold if
your terminal supports that.
</p>
<p>Syntax highlighting does incur a slight penalty in memory used per line of
text, and it also consumes some CPU resources. For small to medium sized
files you’ll probably never notice. But for extremely large files—on
the order of the size of your system’s RAM—the difference could be
significant. If you invoke <code>ne</code> with the <code>--no-syntax</code>
parameter, <code>ne</code> will disable the syntax highlighting mechanism
entirely, freeing up the memory and CPU otherwise consumed. (Note that
if you are that tight on memory, you may need to disable the undo
buffer as well. See <a href="DoUndo.html#DoUndo">DoUndo</a>.) On the other hand, <code>ne</code> will silently
disable syntax highlighting on files longer than ten million bytes, but
you can force it using the <code>Syntax</code> command.
</p>
<p>Note that there is a basic difference between these two cases: when you
use the <code>--no-syntax</code> parameter, the additional memory is not
allocated at all, and syntax highlighting cannot be enabled without
restarting <code>ne</code>. On the contrary, the automatic disabling for long
files keeps only <code>ne</code> from computing the actual highlighting, and it
can be overriden as explained above.
</p>
<p><code>ne</code> uses code from another editor—the GPL-licensed
<code>joe</code>—for its syntax highlighting capabilities. Because of this fact, the
syntax definition files are identical, even to the ‘<samp>.jsf</samp>’
extension, which is an acronym for “Joe’s Syntax File”. It’s possible
that if both <code>joe</code> and <code>ne</code> are installed on your system that
they share the same syntax file directory.
</p>
<hr>
<div class="header">
<p>
Next: <a href="Menus.html#Menus" accesskey="n" rel="next">Menus</a>, Previous: <a href="The-Requester.html#The-Requester" accesskey="p" rel="prev">The Requester</a>, Up: <a href="Reference.html#Reference" accesskey="u" rel="up">Reference</a> [<a href="Command-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>
|