Monday, January 16, 2012

Re: What did I do?

On 01/16/12 17:36, Eric Weir wrote:
> Still not quite clear about the concept of "flowing" and
> "reflowed" text. The way Tim put it makes it sound like all
> paragraphs, not just each paragraph, on one line.
>
> I'm not sure what I have. I have vim set to wrap lines at the
> screen, but I don't think there's any wrapping in the file.
> So does my text "flow" or not?

Reflowing (as I intended it to mean, which I apparently didn't
convey well enough...sorry) is indeed what was going on in the
thread Ben Fritz linked to. In this case, one might start with
paragraphs like

this is some text
and this is some
more text

and a paragraph
with some extra
text in it

containing 7 newlines (one after each line of text, and two
between the paragraphs) and one word might be inserted
"reflowing" the first paragraph to

this is some keen
text and this is
some more text

using "gq<motion>" to "reflow" the text according to your
'textwidth' (or 'wrapmargin' setting, something like a
ludicrously small "textwidth=17" in this example). A traditional
diff (such as "diff" or Vim's diffing) would tell you that *all
three* lines of that first paragraph changed. OOTH, the
prose-author likely only wants to know that the word "keen" was
inserted (ignoring the reflowing changes).

If your paragraphs are all one line (as I think I understand you
describing your text) separated by one or two newlines,
traditional diffs should work pretty well. They'd at a minimum
show you which paragraphs changed between the two documents.
With vimdiff, it also highlights interline changes, though it
might require scrolling horizontally to see the individual
changes. Thus you'd have

this is some text and this is some more text

and a paragraph with some extra text in it

and the 'wrap' option would *display* them broken but they
wouldn't contain any newlines within the paragraphs themselves.
When you inserted "keen", the first paragraph would become

this is some keen text and this is some more text

and vimdiffing them would highlight the line as changed (colored
with "hi DiffChange" color), and highlight the word "keen"
(colored with "hi DiffText" color).

If you have two line-breaks to mark paragraphs and your
paragraphs *do* contain line-breaks (what I understand you are
NOT doing), the "wdiff" tool mentioned in the other thread helps
to sensibly highlight those changes when text is reflowed where
traditional diff/vimdiff produces noisy results.

Hope my prolix proclivities elucidated matters :)

-tim

--
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: