I want vim to wrap long lines, but not split words in the middle. I found this post: Word wrap in Gvim
but that does not work for me. I already have l
in formatoptions and linebreak enabled.
:set formatoptions?
formatoptions=lnq
As you can see, it is still splitting words: http://i.imgur.com/ekJIHww.png
After consulting the relevant help pages, I also tried setting breakat
to \s
, but that didn't work either.
As you found out this is done using the 'linebreak'
option (with 'wrap'
on).
If on Vim will wrap long lines at a character in
'breakat'
rather than at the last character that fits on the screen.
And since 'breakat'
by default contains Space and Tab and some punctuation characters, this should break lines as expected (not in the middle of a word). I suggest resetting 'breakat'
to the Vim default in case it has been changed by a plugin or a mapping.
Oh, and don't set 'list'
, these features don't mix.
All together now:
:set nolist wrap linebreak breakat&vim
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With