Lines 191-207
Install from package:editors/nano[] or package:editors/nano-devel[].
Link Here
|
191 |
[[editor-config-nano-config]] |
191 |
[[editor-config-nano-config]] |
192 |
=== Configuration |
192 |
=== Configuration |
193 |
|
193 |
|
194 |
Copy the sample XML syntax highlight file to the user's home directory: |
194 |
Currently there is no adoc/asciidoc syntax highlight file with nano distribution. So let's create one from scratch and use an editor to create new file or add lines in the [.filename]#~/.nanorc# with these contents: |
195 |
|
|
|
196 |
[source,shell] |
197 |
.... |
198 |
% cp /usr/local/share/nano/xml.nanorc ~/.nanorc |
199 |
.... |
200 |
|
201 |
Use an editor to replace the lines in the [.filename]#~/.nanorc# `syntax "xml"` block with these rules: |
202 |
|
195 |
|
203 |
.... |
196 |
.... |
204 |
syntax "xml" "\.([jrs]html?|xml|xslt?)$" |
197 |
syntax "asciidoc" "\.(adoc|asc|asciidoc)$" |
|
|
198 |
# main header |
199 |
color red "^====+$" |
200 |
# h1 |
201 |
color red "^==[[:space:]].*$" |
202 |
color red "^----+$" |
203 |
# h2 |
204 |
color magenta "^===[[:space:]].*$" |
205 |
color magenta "^~~~~+$" |
206 |
# h4 |
207 |
color green "^====[[:space:]].*$" |
208 |
color green "^\^\^\^\^+$" |
209 |
# h5 |
210 |
color brightblue "^=====[[:space:]].*$" |
211 |
color brightblue "^\+\+\+\++$" |
212 |
# attributes |
213 |
color brightgreen ":.*:" |
214 |
color brightred "\{[a-z0-9]*\}" |
215 |
color red "\\\{[a-z0-9]*\}" |
216 |
color red "\+\+\+\{[a-z0-9]*\}\+\+\+" |
217 |
# Paragraph Title |
218 |
color yellow "^\..*$" |
219 |
# source |
220 |
color magenta "^\[(source,.+|NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]" |
221 |
# Other markup |
222 |
color yellow ".*[[:space:]]\+$" |
223 |
color yellow "_[^_]+_" |
224 |
color yellow "\*[^\*]+\*" |
225 |
color yellow "\+[^\+]+\+" |
226 |
color yellow "`[^`]+`" |
227 |
color yellow "\^[^\^]+\^" |
228 |
color yellow "~[^~]+~" |
229 |
color yellow "'[^']+'" |
230 |
color cyan "`{1,2}[^']+'{1,2}" |
231 |
# bullets |
232 |
color brightmagenta "^[[:space:]]*[\*\.-]{1,5}[[:space:]]" |
233 |
# anchors |
234 |
color brightwhite "\[\[.*\]\]" |
235 |
color brightwhite "<<.*>>" |
205 |
# trailing whitespace |
236 |
# trailing whitespace |
206 |
color ,blue "[[:space:]]+$" |
237 |
color ,blue "[[:space:]]+$" |
207 |
# multiples of eight spaces at the start a line |
238 |
# multiples of eight spaces at the start a line |
Lines 211-218
color ,blue "^([TAB]*[ ]{8})+"
Link Here
|
211 |
color ,yellow "( )+TAB" |
242 |
color ,yellow "( )+TAB" |
212 |
# highlight indents that have an odd number of spaces |
243 |
# highlight indents that have an odd number of spaces |
213 |
color ,red "^(([ ]{2})+|(TAB+))*[ ]{1}[^ ]{1}" |
244 |
color ,red "^(([ ]{2})+|(TAB+))*[ ]{1}[^ ]{1}" |
214 |
# lines longer than 70 characters |
|
|
215 |
color ,yellow "^(.{71})|(TAB.{63})|(TAB{2}.{55})|(TAB{3}.{47}).+$" |
216 |
.... |
245 |
.... |
217 |
|
246 |
|
218 |
Process the file to create embedded tabs: |
247 |
Process the file to create embedded tabs: |
Lines 229-235
Specify additional helpful options when running the editor:
Link Here
|
229 |
|
258 |
|
230 |
[source,shell] |
259 |
[source,shell] |
231 |
.... |
260 |
.... |
232 |
% nano -AKipwz -r 70 -T8 _index.adoc |
261 |
% nano -AKipwz -T8 _index.adoc |
233 |
.... |
262 |
.... |
234 |
|
263 |
|
235 |
Users of man:csh[1] can define an alias in [.filename]#~/.cshrc# to automate these options: |
264 |
Users of man:csh[1] can define an alias in [.filename]#~/.cshrc# to automate these options: |