On Wed, Dec 06, 2006 at 02:32:12PM +0000, A. S. Budden wrote: > On 06/12/06, Karsten Gerloff <[EMAIL PROTECTED]> wrote: > >Hi, > > > >I'm currently writing a lot of text in vim that will later need to > >transfer to a word processor (OpenOffice 2.0 in this case). > > > >Since it makes reading easier, I want to make lines wrap at 66 > >chars; this has long worked fine with > > > > set textwidth=66 > > > >But this inserts hard line breaks (<EOL>), which I don't want to > >show up later in the word processor. No luck at vim.org. So I > >tried the vim FAQ at > > > > http://vimdoc.sourceforge.net/vimfaq.html > > > >and it told me to put the following into my .vimrc: > > > > :set wrap > > :set linebreak > > :set textwidth=0 > > :set showbreak=>>> > > > >which works nicely as far as the EOLs are concerned. But the lines > >still run over the whole width of the screen. Setting textwidth=66 > >re-introduces the unwanted EOLs. > > > >Any hints? > > I find that the easiest way is to set tw to whatever you want it to > be, write the text and then (just before pasting into OpenOffice): > > :set tw=10000 > gggqG > gg"+G > > To reformat the text with long lines. Assuming formatoptions is set > to something sensible, this works a treat.
It does indeed! Thanks for this great hint -- especially useful
since I already have large amounts of text I need to move into
OpenOffice.
To make it still more convenient, I turned it into a macro and
mapped it to F4:
map <F4> :set tw=10000<CR>gggqGgg"+G
The only thing I haven't managed yet is to set textwidth back to
66 after that. Simply appending
:set tw=66<CR>
doesn't work.
best,
Karsten
--
UNU-MERIT <http://www.merit.unu.edu>
Researcher Free Software & Access to Knowledge
Tel. +31 (0) 3506 378 // Keizer Karelplein 19
6211 TC Maastricht // The Netherlands
signature.asc
Description: Digital signature
