Currently, a colleague and I are working on a joint project written in LaTeX. I am using a plugin (VimTeX) which, in addition to calling a compiler tool (upon saving the file) offers some bindings for ease of use. Given my familiarity with the plugin and vim in general I would prefer not to switch to another option.
Recently, we noticed that his editor (TeXStudio) will catch all the changes I make once I save (we are sharing via Dropbox) while we are simultaneously editing the .tex file. It also appears that after a few second delay (following a save on his end) gvim will let me know that changes have been made to the file and prompt me to either open the edited version or not -- however doing this I seem to lose my work as I can't save the file without overwriting the work he just completed. I appreciate that vim lets me know that he has recompiled the file, but could it just make the changes he saved and act as nothing I've done has changed?
For clarity I am providing an example:
- Friend and I both have editor open to shared .tex file.
- Friend adds text to section 2.
- I add text to section 3.
- If my friend saves the file first I eventually get a message from vim as I described above.
- If I use his saved version then I lose the changes I made to section 3. If instead I keep going with my version and save, his changes are never seen by my editor, and so once I save it will overwrite the changes he just made.
- If I save the file first, he will see the changes I made to section 3 pop up in his editor and he gets to keep his work (in section 2). Then, he can save the file with both of our changes in place.
My preference would be for the work I'm doing and the work my friend has done to merge nicely similar to the way things work on his end. We don't work on the same sections of the document at the same time so there is no harm in this type of result being achieved. If this cannot be done, I am open to other suggestions.