如何区分重新包装的文本?
编辑文档时,我总是坚持最大 80 或 150 个字符的特定行宽,具体取决于我正在编写的内容(代码、文本等)。如果我只改变一点点,整个段落就会移动,因此多行现在以不同的顺序排列,以最适合给定的线宽。我如何区分它以查看实际的变化而不是重新包装的工件?
示例,文本宽度=30:
实际更改相当微小:
- 第 9 行插入:“现在我改变了一点”
- 第 15 行插入: “在这里填写一些东西,用更多的行写出全新的东西。”
- 第 18 行更改:s/Duis/TYPO/
如果其他软件可以完成所需的差异,我在这里使用 (g)vimdiff 的事实并不重要。
当然,软件设计为当文本到达窗口边框时自动换行,因此我也尝试在段落末尾仅使用换行符。这不好的原因是,自动差异是基于行的,对于段落中的小变化,我得到整行,这意味着整个段落作为差异更新:(。
When editing documents I always stick to a certain line width of max 80 or 150 characters, depends what I am writing (code, text, etc.). If I change only a little the whole paragraph will shift and hence multiple lines are now in different order to optimal fit for the given line width. How do I diff this to see the actual real change an not the rewrapping artifacts?
Example, textwidth=30:
The actual changes are rather tiny:
- line 9 insert: "Now I change a little"
- line 15 insert: "Fill in here something and write totally new stuff with much more lines. "
- line 18 change: s/Duis/TYPO/
The fact that I use (g)vimdiff here is of no matter, if other software can accomplish the desired diff.
Of course software is designed to wrap automatically when text reaches window borders, so I also tried to use just line breaks in the end of a paragraph. The reason why this is not good is, that automatically diffs are line based, and for small changes in paragraphs I get the whole line, meaning then the whole paragraph as diff update :(.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
GNU wdiff 进行逐字比较,不会以任何不同的方式处理空格和换行符。人们甚至可以找到它的 vim 语法文件(例如此处)。
(
[- ... -]
是删除的文本,{+ ... +}
是插入的文本)。(还有其他 diff 程序可以做类似的事情:例如 adiff,也许还有一些列于https://stackoverflow.com/questions/12625/best-diff-tool)
GNU wdiff does a word-by-word diff, not treating spaces and new lines any differently. One can even find vim syntax files for it (e.g. here).
(
[- ... -]
is deleted text,{+ ... +}
is inserted text).(There are other diff programs that do a similar thing: e.g. adiff, and maybe some of the ones listed in https://stackoverflow.com/questions/12625/best-diff-tool)
我喜欢使用超越比较进行这种并排文件比较。还可以让您进行文件夹比较和位级比较,您可以右键单击以选择左侧文件进行比较,然后再单击另一个文件以选择右侧文件;或者选择两个文件并右键单击“比较”以立即将它们显示出来。
I like Beyond Compare for this kind of side-by-side file comparison. Also lets you do folder comparisons and bit-level comparisons, and you can right-click to select the left-hand file to compare, then another to select the right-hand one; or select two files and right-click Compare to bring them both up straight away.
我使用 DiffMerge,它是免费的,可以在许多平台上使用。
I use DiffMerge which is free and available on many platforms.