i think that the options 'textwidth' and 'wrapmargin' are effective only
while editing the file and adding _new_ lines...not for existing lines which
will not change whatever value you assign to those options.Am I right?
--
View this message in context: http://vim.1045645.n5.nabble.com/how-do-is-set-wrap-for-reading-a-file-that-was-already-edited-before-tp2642934p2642934.html
Sent from the Vim - General mailing list archive at Nabble.com.
It depends on whether you want re-wrapping that inserts newlines,
or if you just want to visually wrap the lines without effecting
their contents (by adding newlines)
For the former, you can use
:set tw=65 " whatever you want
:g/^/norm gqq
to reformat each line to the adjusted 'tw' setting. Note that
this will not *join* lines as "gqip" would. You could adjust the
:global command to something like
:g/^\n\</norm gq}
(untested) to reformat each empty-line-separated paragraph.
For the latter, you can
:set wrap
and optionally
:set linebreak
to get smart line-breaking that breaks at word-boundaries instead
of at the column-boundary.
Hope this helps,
-tim
Read the help starting at :h formatting and :h usr_25.txt
regards,
Christian