Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 stackoverflow.com 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
add comment

3 Answers

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
add comment

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
add comment

Use this option in your .vimrc or at runtime:

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.