Proper word-wrapping in vim

That last post took hours to put together, so this one will be short and brief. A long time ago I found two settings for vim that, when used in conjunction, give me the word wrapping I need when I compose these posts from within Charm. I never made a note of them, which is bad form.

The problem is something I’ve talked about before, so I’ll spare you the long and boring reason for needing that behavior. Under Crux, the plain-jane vim that gets built doesn’t word-wrap; instead, words are simply broken at the end of the line. Nothing wrong with that, but with

set formatoptions=l
set lbr

in my .vimrc, words break at spaces or hyphens, and links break at slashes or hyphens. It’s a very nice adjustment, particularly if you want vim to behave a little more like a word processor, and not so much like a text editor. Not that there’s anything wrong with that. :)

About these ads

7 thoughts on “Proper word-wrapping in vim

  1. Pingback: Blasphemer! DOSBox and Word 5.5 « Motho ke motho ka botho

  2. Winston

    How is it that I spent hours after a vim tutorial trying to figure out how to do just this, and now, months later, finally stumble upon it?

    Love this blog, by the way. Can’t understand half the stuff you’re talking about but the other half has come in handy, particularly with my ten year old Sony Vaio.

    Reply
    1. K.Mandla Post author

      I am glad you enjoy it. And don’t worry — half the stuff I write about, I don’t fully understand either. :oops: :mrgreen:

      Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s