Add an editor configuration chapter that shows helpful configurations for
specific editors. Other editor configuration content will be moved to this chapter.
This commit is contained in:
parent
846aa0df3a
commit
bf9ac0fea5
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/head/; revision=42381
4 changed files with 124 additions and 0 deletions
|
@ -33,6 +33,7 @@ SRCS+= stylesheets/chapter.xml
|
|||
SRCS+= translations/chapter.xml
|
||||
SRCS+= writing-style/chapter.xml
|
||||
SRCS+= psgml-mode/chapter.xml
|
||||
SRCS+= editor-config/chapter.xml
|
||||
SRCS+= see-also/chapter.xml
|
||||
|
||||
SRCS+= examples/appendix.xml
|
||||
|
|
|
@ -261,6 +261,7 @@ The time is 09:18</screen></entry>
|
|||
&chap.translations;
|
||||
&chap.writing-style;
|
||||
&chap.psgml-mode;
|
||||
&chap.editor-config;
|
||||
&chap.see-also;
|
||||
|
||||
&app.examples;
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
<!ENTITY chap.translations SYSTEM "translations/chapter.xml">
|
||||
<!ENTITY chap.writing-style SYSTEM "writing-style/chapter.xml">
|
||||
<!ENTITY chap.psgml-mode SYSTEM "psgml-mode/chapter.xml">
|
||||
<!ENTITY chap.editor-config SYSTEM "editor-config/chapter.xml">
|
||||
<!ENTITY chap.see-also SYSTEM "see-also/chapter.xml">
|
||||
|
||||
<!ENTITY app.examples SYSTEM "examples/appendix.xml">
|
||||
|
|
121
en_US.ISO8859-1/books/fdp-primer/editor-config/chapter.xml
Normal file
121
en_US.ISO8859-1/books/fdp-primer/editor-config/chapter.xml
Normal file
|
@ -0,0 +1,121 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- Copyright (c) 2013 Warren Block
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
$FreeBSD$
|
||||
-->
|
||||
|
||||
<chapter id="editor-config">
|
||||
<title>Editor Configuration</title>
|
||||
|
||||
<para>Adjusting text editor configuration can make working on
|
||||
document files quicker and easier, and help documents conform to
|
||||
<acronym>FDP</acronym> guidelines.</para>
|
||||
|
||||
<sect1 id="editor-config-vim">
|
||||
<title><application>Vim</application></title>
|
||||
|
||||
<para>Install from <filename role="package">editors/vim</filename>
|
||||
or <filename role="package">editors/vim-lite</filename>.</para>
|
||||
|
||||
<para>Edit <filename>~/.vimrc</filename>, adding these
|
||||
lines:</para>
|
||||
|
||||
<programlisting>augroup sgmledit
|
||||
autocmd FileType sgml set formatoptions=cq2l " Special formatting options
|
||||
autocmd FileType sgml set textwidth=70 " Wrap lines at 70 columns
|
||||
autocmd FileType sgml set shiftwidth=2 " Automatically indent
|
||||
autocmd FileType sgml set softtabstop=2 " Tab key indents 2 spaces
|
||||
autocmd FileType sgml set tabstop=8 " Replace 8 spaces with a tab
|
||||
autocmd FileType sgml set autoindent " Automatic indentation
|
||||
augroup END</programlisting>
|
||||
|
||||
</sect1>
|
||||
|
||||
<sect1 id="editor-config-emacs">
|
||||
<title><application>Emacs</application></title>
|
||||
|
||||
<para>Install from
|
||||
<filename role="package">editors/emacs</filename>
|
||||
or <filename role="package">editors/xemacs</filename>.</para>
|
||||
|
||||
<para>Edit <filename>~/.emacs</filename>, adding these
|
||||
lines:</para>
|
||||
|
||||
<programlisting> (defun local-sgml-mode-hook
|
||||
(setq fill-column 70
|
||||
indent-tabs-mode nil
|
||||
next-line-add-newlines nil
|
||||
standard-indent 4
|
||||
sgml-indent-data t)
|
||||
(auto-fill-mode t)
|
||||
(setq sgml-catalog-files '("/usr/local/share/xml/catalog")))
|
||||
(add-hook 'psgml-mode-hook
|
||||
'(lambda () (local-psgml-mode-hook)))</programlisting>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="editor-config-nano">
|
||||
<title><application>nano</application></title>
|
||||
|
||||
<para>Install from
|
||||
<filename role="package">editors/nano</filename> or
|
||||
<filename role="package">editors/nano-devel</filename>.</para>
|
||||
|
||||
<para>Configuration:</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>
|
||||
|
||||
<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>
|
||||
|
||||
<para>Specify additional helpful options when running the
|
||||
editor.</para>
|
||||
|
||||
<screen>&prompt.user; <userinput>nano -AKipwz -r 70 -T8 <replaceable>chapter.xml</replaceable></userinput></screen>
|
||||
|
||||
<para>Users of &man.csh.1; can define an alias in
|
||||
<filename>~/.cshrc</filename> to automate these options:</para>
|
||||
|
||||
<programlisting>alias nano "nano -AKipwz -r 70 -T8"</programlisting>
|
||||
|
||||
<para>After the alias is defined, the options will be added
|
||||
automatically:</para>
|
||||
|
||||
<screen>&prompt.user; <userinput>nano <replaceable>chapter.xml</replaceable></userinput></screen>
|
||||
</sect1>
|
||||
</chapter>
|
Loading…
Reference in a new issue