From bf9ac0fea50d0a55b906a1b440eff1db3476adf9 Mon Sep 17 00:00:00 2001 From: Warren Block Date: Mon, 22 Jul 2013 19:55:25 +0000 Subject: [PATCH] Add an editor configuration chapter that shows helpful configurations for specific editors. Other editor configuration content will be moved to this chapter. --- en_US.ISO8859-1/books/fdp-primer/Makefile | 1 + en_US.ISO8859-1/books/fdp-primer/book.xml | 1 + en_US.ISO8859-1/books/fdp-primer/chapters.ent | 1 + .../fdp-primer/editor-config/chapter.xml | 121 ++++++++++++++++++ 4 files changed, 124 insertions(+) create mode 100644 en_US.ISO8859-1/books/fdp-primer/editor-config/chapter.xml diff --git a/en_US.ISO8859-1/books/fdp-primer/Makefile b/en_US.ISO8859-1/books/fdp-primer/Makefile index 46fdf9e30e..96a61ec00c 100644 --- a/en_US.ISO8859-1/books/fdp-primer/Makefile +++ b/en_US.ISO8859-1/books/fdp-primer/Makefile @@ -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 diff --git a/en_US.ISO8859-1/books/fdp-primer/book.xml b/en_US.ISO8859-1/books/fdp-primer/book.xml index 95eb2124f4..e1b42f5a90 100644 --- a/en_US.ISO8859-1/books/fdp-primer/book.xml +++ b/en_US.ISO8859-1/books/fdp-primer/book.xml @@ -261,6 +261,7 @@ The time is 09:18 &chap.translations; &chap.writing-style; &chap.psgml-mode; + &chap.editor-config; &chap.see-also; &app.examples; diff --git a/en_US.ISO8859-1/books/fdp-primer/chapters.ent b/en_US.ISO8859-1/books/fdp-primer/chapters.ent index 088af94e23..8005f12f13 100644 --- a/en_US.ISO8859-1/books/fdp-primer/chapters.ent +++ b/en_US.ISO8859-1/books/fdp-primer/chapters.ent @@ -23,6 +23,7 @@ + diff --git a/en_US.ISO8859-1/books/fdp-primer/editor-config/chapter.xml b/en_US.ISO8859-1/books/fdp-primer/editor-config/chapter.xml new file mode 100644 index 0000000000..68e5c76ce5 --- /dev/null +++ b/en_US.ISO8859-1/books/fdp-primer/editor-config/chapter.xml @@ -0,0 +1,121 @@ + + + + + Editor Configuration + + Adjusting text editor configuration can make working on + document files quicker and easier, and help documents conform to + FDP guidelines. + + + <application>Vim</application> + + Install from editors/vim + or editors/vim-lite. + + Edit ~/.vimrc, adding these + lines: + + 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 + + + + + <application>Emacs</application> + + Install from + editors/emacs + or editors/xemacs. + + Edit ~/.emacs, adding these + lines: + + (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))) + + + + <application>nano</application> + + Install from + editors/nano or + editors/nano-devel. + + Configuration: + + &prompt.user; cp /usr/local/share/nano/xml.nanorc ~/.nanorc + + Use printf to add lines to the + configuration file. Some have embedded Tab + characters, making this easier than editing the file + directly: + + &prompt.user; printf '# trailing whitespace\n' >> ~/.nanorc +&prompt.user; printf 'color ,blue "[[:space:]]+$"\n' >> ~/.nanorc +&prompt.user; printf '# multiples of eight spaces at the start a line\n' >> ~/.nanorc +&prompt.user; printf '# (after zero or more tabs) should be a tab\n' >> ~/.nanorc +&prompt.user; printf 'color ,blue "^([\t]*[ ]{8})+"\n' >> ~/.nanorc +&prompt.user; printf '# tabs after spaces\n' >> ~/.nanorc +&prompt.user; printf 'color ,yellow "( )+\t"\n' >> ~/.nanorc +&prompt.user; printf '# lines longer than 70 characters\n' >> ~/.nanorc +&prompt.user; printf 'color ,red "^(([ ]{2})+|(\t+))*[ ]{1}[^ ]{1}"\n' >> ~/.nanorc + + Specify additional helpful options when running the + editor. + + &prompt.user; nano -AKipwz -r 70 -T8 chapter.xml + + Users of &man.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: + + &prompt.user; nano chapter.xml + +