Install from editors/nano or editors/nano-devel.
Copy the sample XML syntax highlight file to the user's home directory:
%cp /usr/local/share/nano/xml.nanorc ~/.nanorc
Use an editor to replace the lines in the
~/.nanorc syntax "xml"
block with these rules:
syntax "xml" "\.([jrs]html?|xml|xslt?)$"
# 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}).+$"Process the file to create embedded tabs:
%perl -i'' -pe 's/TAB/\t/g' ~/.nanorc
Specify additional helpful options when running the editor:
%nano -AKipwz -r 70 -T8chapter.xml
Users of csh(1) can define an alias in
~/.cshrc to automate these
options:
alias nano "nano -AKipwz -r 70 -T8"
After the alias is defined, the options will be added automatically:
%nanochapter.xml
All FreeBSD documents are available for download at https://download.freebsd.org/ftp/doc/
Questions that are not answered by the
documentation may be
sent to <freebsd-questions@FreeBSD.org>.
Send questions about this document to <freebsd-doc@FreeBSD.org>.