Wednesday, August 17, 2011

Re: user specified wrapping w/o linebreak?

On Aug 17, 1:00 pm, ninjaaron <ninjaa...@gmail.com> wrote:
> I've started using vim in the tty for creating prose (as opposed to code)
> without any distractions. This works fairly well, but there is a problem
> with wrapping. Obviously, having lines go all the way across the screen is
> difficult to read. I need the text to wrap at somewhere around 70-80
> characters.
>
> I've tried doing this with the textwidth (tw) and wrapmargin (wm) options.
> This works well within the buffer, but it creates line breaks, which is a
> pain if I want to move the text into a WYSIWYG editor or post it on my blog.
>
> Is there a way to make the text wrap within the buffer at 72 characters
> without actually creating a line break?

Try ":set tw=9999 wrap lbr".

You can easily "recalculate" hard line breaks in a paragraph by
setting the desired textwidth and issuing "{gq}" in normal mode. Do
the whole file by issuing "1GgqG".

This means that if textwidth=9999 before creating the line breaks as
per above, there will actually be no hard line breaks within a
paragraph. In that case, the wrap option causes the text to visually
wrap at the right edge of the window. The lbr option prevents the
wrapping from occurring in the middle of a word.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: