Index: head/en_US.ISO8859-1/books/fdp-primer/editor-config/chapter.xml =================================================================== --- head/en_US.ISO8859-1/books/fdp-primer/editor-config/chapter.xml (revision 48904) +++ head/en_US.ISO8859-1/books/fdp-primer/editor-config/chapter.xml (revision 48905) @@ -1,170 +1,172 @@ 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. + or editors/vim-lite, then follow the + configuration instructions in + . + + Use + + Press P to reformat paragraphs or text that has been selected in Visual mode. Press + T to replace groups of eight spaces with a + tab. + + Configuration Edit ~/.vimrc, adding these - lines: + lines to the end of the file: if has("autocmd") au BufNewFile,BufRead *.sgml,*.ent,*.xsl,*.xml call Set_SGML() au BufNewFile,BufRead *.[1-9] call ShowSpecial() endif " has(autocmd) function Set_Highlights() "match ExtraWhitespace /^\s* \s*\|\s\+$/ highlight default link OverLength ErrorMsg match OverLength /\%71v.\+/ return 0 endfunction function ShowSpecial() setlocal list listchars=tab:>>,trail:*,eol:$ hi def link nontext ErrorMsg return 0 endfunction " ShowSpecial() function Set_SGML() setlocal number syn match sgmlSpecial "&[^;]*;" setlocal syntax=sgml setlocal filetype=xml setlocal shiftwidth=2 setlocal textwidth=70 setlocal tabstop=8 setlocal softtabstop=2 setlocal formatprg="fmt -p" setlocal autoindent setlocal smartindent " Rewrap paragraphs noremap P gqj " Replace spaces with tabs noremap T :s/ /\t/<CR> call ShowSpecial() call Set_Highlights() return 0 endfunction " Set_SGML() - - - - Use - - Press P to reformat paragraphs or text that has been selected in Visual mode. Press - T to replace groups of eight spaces with a - tab. <application>Emacs</application> Install from editors/emacs or editors/xemacs. Edit ~/.emacs, adding this line: (add-hook 'nxml-mode-hook 'turn-on-auto-fill) <application>nano</application> Install from editors/nano or editors/nano-devel. Configuration Copy the sample XML syntax highlight file to the user's home directory: &prompt.user; cp /usr/local/share/nano/xml.nanorc ~/.nanorc Add these lines to the new ~/.nanorc. 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: &prompt.user; perl -i'' -pe 's/TAB/\t/g' ~/.nanorc Use 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