From owner-svn-doc-head@FreeBSD.ORG Wed Jun 25 13:45:56 2014 Return-Path: Delivered-To: svn-doc-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4AD28DE4; Wed, 25 Jun 2014 13:45:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B7C429A5; Wed, 25 Jun 2014 13:45:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s5PDjubm030001; Wed, 25 Jun 2014 13:45:56 GMT (envelope-from wblock@svn.freebsd.org) Received: (from wblock@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s5PDjuJs030000; Wed, 25 Jun 2014 13:45:56 GMT (envelope-from wblock@svn.freebsd.org) Message-Id: <201406251345.s5PDjuJs030000@svn.freebsd.org> From: Warren Block Date: Wed, 25 Jun 2014 13:45:56 +0000 (UTC) To: doc-committers@freebsd.org, svn-doc-all@freebsd.org, svn-doc-head@freebsd.org Subject: svn commit: r45121 - head/en_US.ISO8859-1/books/fdp-primer/editor-config X-SVN-Group: doc-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-doc-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the doc tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jun 2014 13:45:56 -0000 Author: wblock Date: Wed Jun 25 13:45:55 2014 New Revision: 45121 URL: http://svnweb.freebsd.org/changeset/doc/45121 Log: Update the vim editor config section, adding gjb's .vimrc. Also add a a post-processing step to avoid an embedded literal tab, and a short note on usage. PR: 191137 Submitted by: venture37@geeklan.co.uk Modified: head/en_US.ISO8859-1/books/fdp-primer/editor-config/chapter.xml Modified: head/en_US.ISO8859-1/books/fdp-primer/editor-config/chapter.xml ============================================================================== --- head/en_US.ISO8859-1/books/fdp-primer/editor-config/chapter.xml Wed Jun 25 00:34:43 2014 (r45120) +++ head/en_US.ISO8859-1/books/fdp-primer/editor-config/chapter.xml Wed Jun 25 13:45:55 2014 (r45121) @@ -40,18 +40,63 @@ Install from editors/vim or editors/vim-lite. + + Configuration + 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 + 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 OverLength ctermbg=red ctermfg=white guibg=#592929 + match OverLength /\%71v.\+/ + return 0 +endfunction + +function ShowSpecial() + setlocal list listchars=tab:>>,trail:*,eol:$ + hi nontext ctermfg=red + 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 + :map P gqj + " Replace spaces with tabs + :map T :s/ /TAB/<CR> + call ShowSpecial() + call Set_Highlights() + return 0 +endfunction " Set_SGML() + Process the file to create embedded tabs: + + &prompt.user; perl -i'' -pe 's/TAB/\t/g' ~/.vimrc + + + + Use + + Press P to reformat paragraphs. Press + T to replace groups of eight spaces with a + tab. +