Vim, LaTeX, and version controlI

Posted by Bkkbrad on Stack Overflow See other posts from Stack Overflow or by Bkkbrad
Published on 2010-04-26T01:30:32Z Indexed on 2010/04/26 1:33 UTC
Read the original article Hit count: 345

Filed under:
|
|
|

I'm writing a LaTeX document in vim, and I have it hard wrapping at 80 characters to make reading easier. However, this causes problems with tracking changes with in version control. For example, inserting "Lorem ipsum" at the beginning of this text:

1 Dolor sit amet, consectetur adipiscing elit. Phasellus bibendum lobortis lectus
2 quis porta. Aenean vestibulum magna vel purus laoreet at molestie massa
3 suscipit. Vestibulum vestibulum, mauris nec convallis ultrices, tellus sapien
4 ullamcorper elit, dignissim consectetur justo tellus et nunc. 

results in:

1 Lorum ipsum dolor sit amet, consectetur adipiscing elit. Phasellus bibendum
2 lobortis lectus quis porta. Aenean vestibulum magna vel purus laoreet at
3 molestie massa suscipit. Vestibulum vestibulum, mauris nec convallis ultrices,
4 tellus sapien ullamcorper elit, dignissim consectetur justo tellus et nunc.

When I review this change in git, it tells me that all the lines of the paragraph have changed because of the wrapping, even though only one semantic change has occurred. One way around this problem is to have every sentence on its own line. This looks the same in the rendered document, but the source now is harder to read, because each line has quite a different line length:

1 Lorum ipsum dolor sit amet, consectetur adipiscing elit.
2 Phasellus bibendum lobortis lectus quis porta.
3 Aenean vestibulum magna vel purus laoreet at molestie massa suscipit.
4 Vestibulum vestibulum, mauris nec convallis ultrices, tellus sapien ullamcorper elit, dignissim consectetur justo tellus et nunc.

(If I soft wrap at 80, things still look bad, just in a different way.)

Is it possible to have my text on disk with one newline per sentence, but display and edit it in vim as if the text of each paragraph was one long line, soft wrapped at 80 characters? I assume it requires some vim-foo rather than tweaking git or LaTeX.

© Stack Overflow or respective owner

Related posts about version-control

Related posts about vim