I want to use Vim's soft wrap capability (:set wrap
) to wrap some code at 80 characters, regardless of my actual window width.
I haven't been able to find a way to do this yet - all the soft wrapping seems tied to the width of the window
textwidth
andwrapmargin
are both for hard wrapping (they insert newline characters into the file)- vertical splitting into multiple windows and using
:vertical resize 80
(possibly with:set breakat=
to allow breaks on any character) on one of them sort of works (even though it's a bit hackish), but breaks when using:set number
as the line numbers take up a variable number of columns (depending on the file length) and these are part of the 80.
Is there any way to do this in vim? It doesn't look promising, according to other sources.
Right now my approximation is just to have /^.\{80}\zs.\+
as my default search so it's at least highlighted. I thought about adding a :syntax
item for it, but that broke when it overlapped other syntax items, so I dropped that idea.