4 ms·
Why not add line breaks using your text editor? That will also help your collaborators who prefer not to wrap long lines. I have a hook in my .emacs that turns
by ngoldbaum 13y ago
Why not add line breaks using your text editor? That will also help your collaborators who prefer not to wrap long lines.
I have a hook in my .emacs that turns on auto-fill-mode whenever I open a .md or .rst file. I'd assume there's something analogous for vim or whichever editor you normally work with.
- sdesol 13y agoI see this becoming a trend now, where long lines are used to make it easier to do diffs. I'm on the fence about this since there are pros and cons.
- gabemart 13y agoIn text, hard line breaks can be content rather than presentation, so adding them to the raw file is not always desirable. It would be fantastic if the github web viewers offered this feature. Also, won't it mess up diffs for wrapped text? If you add a few words in the middle of a paragraph and then re-wrap the text, won't the contents of every single following line be altered and show up as a diff?
- sdesol 13y agoUnified and side by side diffs were never really meant for diffing documents. If you do go the route of introducing line breaks to improve readability and/or editing, you really need to use a different diffing algorithm. What I've found useful is the Google diff match and patch library. http://code.google.com/p/google-diff-match-patch/ http://code.google.com/p/google-diff-match-patch/ Its extremely easy to integrate as well. You can see how it handles a markdown diff at: http://ny.testdrive.gitsense.com/index?#pid=23&cid=27&trail= http://ny.testdrive.gitsense.com/index?#pid=23&cid=27&trail=
- likeclockwork 13y agogit diff --word-diff