0

I have been trying to use vim as a wordprocessor to do most of my initial drafting and then open in abiword or open office to do my final printing.

Problem has been, even with :set linebreak and :set wrap, when I open it, there's a ton of line breaks. I have to go and manually remove them.

What I want is to be able to write at 40 columns wrap around softly so that when I open it up in Open Office, it gets restored to whatever that column width is, preserving things like carriage return but without all those linebreaks.

1
  • Vim does not distinguish between what you call "carriage returns" and "linebreaks", basically because ASCII does not have separate control characters for those two functions and there is no convention for distinguishing between those two functions in a plain text file. I wouldn't try to do any formatting, such as setting column widths, in Vim--leave that for Open Office. For your draft, set Vim's window width to 40, set tw=99999, and put actual carriage returns only at the ends of paragraphs. List items and such will have to be paragraphs in the draft.
    – garyjohn
    Dec 28, 2010 at 17:50

3 Answers 3

2

Have you considered feeding your vim-edited text into a plain text processor - this can produce some remarkably good-looking results in PDF RTF or other final form.

If you do this you don't need to worry about line breaks.

2

for soft-wrapping you need to use :set columns instead of :set textwidth or set wrap (which are for hard-wrapping):

:set columns=40
0

Use this option in your .vimrc or at runtime:

:set textwidth=40
1
  • 1
    I believe that adds a linebreak
    – Angela
    Dec 28, 2010 at 4:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .