Simplify and improve the nano config section.
This commit is contained in:
parent
5633c0cd23
commit
c40dc337bb
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/head/; revision=42426
1 changed files with 25 additions and 15 deletions
|
@ -84,27 +84,36 @@ augroup END</programlisting>
|
|||
<filename role="package">editors/nano</filename> or
|
||||
<filename role="package">editors/nano-devel</filename>.</para>
|
||||
|
||||
<para>Configuration:</para>
|
||||
<sect2 id="editor-config-nano-config">
|
||||
<title>Configuration</title>
|
||||
|
||||
<para>Copy the sample <acronym>XML</acronym> syntax highlight
|
||||
file to the user's home directory:</para>
|
||||
|
||||
<screen>&prompt.user; <userinput>cp /usr/local/share/nano/xml.nanorc ~/.nanorc</userinput></screen>
|
||||
|
||||
<para>Use <command>printf</command> to add lines to the
|
||||
configuration file. Some have embedded <keycap>Tab</keycap>
|
||||
characters, making this easier than editing the file
|
||||
directly:</para>
|
||||
<para>Add these lines to the new <filename>~/.nanorc</filename>.</para>
|
||||
|
||||
<screen>&prompt.user; <userinput>printf '# trailing whitespace\n' >> ~/.nanorc</userinput>
|
||||
&prompt.user; <userinput>printf 'color ,blue "[[:space:]]+$"\n' >> ~/.nanorc</userinput>
|
||||
&prompt.user; <userinput>printf '# multiples of eight spaces at the start a line\n' >> ~/.nanorc</userinput>
|
||||
&prompt.user; <userinput>printf '# (after zero or more tabs) should be a tab\n' >> ~/.nanorc</userinput>
|
||||
&prompt.user; <userinput>printf 'color ,blue "^([\t]*[ ]{8})+"\n' >> ~/.nanorc</userinput>
|
||||
&prompt.user; <userinput>printf '# tabs after spaces\n' >> ~/.nanorc</userinput>
|
||||
&prompt.user; <userinput>printf 'color ,yellow "( )+\t"\n' >> ~/.nanorc</userinput>
|
||||
&prompt.user; <userinput>printf '# lines longer than 70 characters\n' >> ~/.nanorc</userinput>
|
||||
&prompt.user; <userinput>printf 'color ,red "^(([ ]{2})+|(\t+))*[ ]{1}[^ ]{1}"\n' >> ~/.nanorc</userinput></screen>
|
||||
<programlisting># trailing whitespace
|
||||
color ,blue "[[:space:]]+$"
|
||||
# multiples of eight spaces at the start a line
|
||||
# (after zero or more tabs) should be a tab
|
||||
color ,blue "^([TAB]*[ ]{8})+"
|
||||
# tabs after spaces
|
||||
color ,yellow "( )+TAB"
|
||||
# highlight indents that have an odd number of spaces
|
||||
color ,red "^(([ ]{2})+|(TAB+))*[ ]{1}[^ ]{1}"
|
||||
# lines longer than 70 characters
|
||||
color ,yellow "^(.{71})|(TAB.{63})|(TAB{2}.{55})|(TAB{3}.{47}).+$"</programlisting>
|
||||
|
||||
<para>Process the file to create embedded tabs:</para>
|
||||
|
||||
<screen>&prompt.user; <userinput>perl -i'' -pe 's/TAB/\t/g' ~/.nanorc</userinput></screen>
|
||||
</sect2>
|
||||
<sect2 id="editor-config-nano-use">
|
||||
<title>Use</title>
|
||||
<para>Specify additional helpful options when running the
|
||||
editor.</para>
|
||||
editor:</para>
|
||||
|
||||
<screen>&prompt.user; <userinput>nano -AKipwz -r 70 -T8 <replaceable>chapter.xml</replaceable></userinput></screen>
|
||||
|
||||
|
@ -117,5 +126,6 @@ augroup END</programlisting>
|
|||
automatically:</para>
|
||||
|
||||
<screen>&prompt.user; <userinput>nano <replaceable>chapter.xml</replaceable></userinput></screen>
|
||||
</sect2>
|
||||
</sect1>
|
||||
</chapter>
|
||||
|
|
Loading…
Reference in a new issue