18

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
2
  • 1
    Some of the answers to stackoverflow.com/q/467739/684934 look promising. (None are accepted, though.)
    – user684934
    Nov 8, 2012 at 17:36
  • @bdares Thanks, I didn't see that one. Still, it doesn't solve my problem, none of the options.
    – greduan
    Nov 8, 2012 at 17:40

2 Answers 2

24
set linebreak

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

8
  • It is on. I do use list. :/
    – greduan
    Nov 8, 2012 at 17:42
  • 3
    Well it's either one or the other. Sorry.
    – romainl
    Nov 8, 2012 at 17:42
  • Is there no way around this? Maybe with a custom function that replaces this functionality?
    – greduan
    Nov 8, 2012 at 17:53
  • No way that I know of: it's a low level feature. Typically the kind of thing you write a patch for.
    – romainl
    Nov 8, 2012 at 19:15
  • I see, thanks for your answers. It's just that when I write text I like it without new lines. (Especially since I change it all the time). Nevertheless, thanks. :)
    – greduan
    Nov 8, 2012 at 21:44
0

My solution to this problem was this Vim wiki page. Thanks to @romainl for convincing me to not use list.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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