Make Vim only do a soft word-wrap, not hard word-wrap

greduan picture greduan · Nov 8, 2012 · Viewed 7.8k times · Source

I've been using Vim for a week now. And I've noticed something.

I have textwidth unset, and I have wrap set. Now, my question is. Currently whenever I line longer than 120 characters (window width), it takes the last character, and just like that, wraps it. So if it's in the middle of a word it looks like this:

This is a very long sen|
tence, this looks very |
strange, don't you thin|
k?                     |

BTW, the | represents the text limit, very short in this case, to prove my point. So that says what my problem is, I would like a simply solution to this, as long as I don't lose any screen real estate.

Of course, the ideal solution would output the following, without modifying the text, only the output, the text remains in one line, but it appears to be spread over several:

This is a very long    |
sentence, this looks   |
very strange, don't you|
think?                 |

Thanks for any help you can provide. :)

Extra info:

  • OS: Mac OSX Mountain Lion
  • Using MacVim

I've tried the following:

set textwidth=120

set wrap
set linebreak

set fo=1

Answer

romainl picture romainl · Nov 8, 2012
set linebreak

is enough. It doesn't work when list is on, though.