Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

migrated from Dec 28 '10 at 9:54

This question came from our site for professional and enthusiast programmers.

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 '10 at 17:50

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.

share|improve this answer

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

:set columns=40
share|improve this answer

Use this option in your .vimrc or at runtime:

:set textwidth=40
share|improve this answer
I believe that adds a linebreak – Angela Dec 28 '10 at 4:31

You must log in to answer this question.

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