[blfs-dev] Large commit

Bruce Dubbs bruce.dubbs at gmail.com
Mon Feb 11 11:20:51 PST 2013


Randy McMurchy wrote:
> Randy McMurchy wrote these words on 02/11/13 12:55 CST:
>> I just ran my script that cleans up extraneous spaces from blank lines and
>> at the end of lines in all the .xml files.
>
> If you use Vim to edit the book's .xml, you can add the following lines
> to your /etc/vimrc file and it will show in red any extraneous spaces in
> the .xml. I find it handy as it makes it easy to keep the files clean.
>
> " Catch trailing whitespace and highlight them
> highlight ForbiddenWhitespace ctermbg=red guibg=red
> match ForbiddenWhitespace /\s\+$\|\t/
> " Do not highlight spaces at the end of line while typing on that line
> autocmd InsertEnter * match ForbiddenWhitespace /\t\|\s\+\%#\@<!$/


I use the F<n> keys to turn these things on and off.  Here is a simple 
example in my ~/.vimrc:

nnoremap \tnum :set invnumber number?<CR>
nmap <F5> \tnum

nnoremap \tl :set invlist list?<CR>
nmap <F2> \tl


For me, F2 turns the list on and off and shows the EOL and makes that 
trailing whitespace fairly obvious.  Of course it only matters in the 
<screen> sections.

   -- Bruce




More information about the blfs-dev mailing list