Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Gdiff and .tex files #137

Open
choufleur opened this Issue · 13 comments

7 participants

@choufleur

Thanks a lot for fugitive. Sorry, this is probably a completely stupid issue.
when I Gdiff a .tex file, vim does open two buffers correctly, but I have to set diff set scrollbind set wrap in each of them, because these variables are not on as they probably should. This does not happen with non .tex files as far as I know. On the other hand this does not seem to be a vimdiff issue, running vimdiff on these two .tex files displays everything correctly. Any clue of what is going on ?

@tpope
Owner

Check :verbose set diff? in each of the buffers and see if something else is mucking with it. Fugitive does little more than :diffthis, so I'd be surprised if it was the culprit.

@choufleur

It must be related to the vim-latex plugin, and not with the content of the file. I tried with a minimal latex file, Gdiff HEAD^ still doesn't work properly, as described above (opens the two buffers correctly but that is it, diff not set on). I made a copy of this file leaving out the .tex suffix to prevent vim-latex from loading, then Gdiff HEAD^ worked fine, with exactly the same content. If I copy the content of the opened buffer in a new .tex file and vimdiff it with the previous one, everything works perfectly, in presence of the vim-latex plugin, so it is not only the combination of the vim-latex plugin and vimdiff. So the issue is the combination of the vim-latex and fugitive plugins, as far as I can tell. The command :verbose set diff in each buffer brings vimdiff back, but seems to offer no explanation.

@tpope
Owner

At 10,000 lines of code, I'll let someone else tackle the task of figuring out what inside vim-latex is causing the issue.

@fundamental

I find this issue to be annoying as well and after a quick inspection it is rather clear that something odd is happening within vim-latex. The reason that fugitive fails to :diffthis on both buffers is a :wincmd p command fails to change windows. I am not sure what in vim-latex causes this issue, (perhaps some temporary split that is destroyed?) but it can be replicated by opening any second latex file in a split and then trying to use :wincmd p or CTRL-W p. A workaround for fugitive could be made, but a fix appears to be needed in vim-latex to stop this unexpected behavior.

@0
0 commented

I think I've found the culprit: Tex_pack_updateall opens and closes splits.

It's called from several places, but the one that causes trouble here is the LatexSuiteFileType autogroup in that file.

@choufleur

Hi, thanks a lot, I am quite impressed, I would have been unable to find this out by myself. But what should we do next ?

@fundamental

I would say figure out a workaround for vim-latex that does not require LatexSuiteFileType to open and close splits. This is way beyond my knowledge of vimscript though.

@tpope
Owner

Four possibilities, starting with the most desirable and least feasible:

  1. Find an alternative to the wincmd p that fugitive does to return to the previous window. This is tricky because windows don't really have an identifier other than an integer that changes as new windows are added and deleted.
  2. Fix that vim-latex function to use readfile() rather than opening and closing a buffer. That code in vim-latex was likely written before readfile() existed.
  3. Find an option to disable that functionality in vim-latex. Vim-latex has like 800 features and I'm guessing none of us would even notice if this particular one was disabled.
  4. Stop using vim-latex. Seriously, I stopped using it years ago once I noticed how much of my vimrc was dedicated to working around all the weird crap it did. All I really cared about was "build the DVI file" and that's easy enough to rig up by hand.
@matsen

Any suggestions to alternatives for vim-latex? I do enjoy the macros, bindings, folding, and tex-informed spell checking. I don't actually use it to build DVI files, and agree that it seems pretty baroque.

@tpope
Owner

let g:tex_fold_enabled = 1. Spell checking looks fine to me. I don't know what macros and bindings it offers but I can't imagine it competing with any modern snippets plugin.

@matsen
@lunaryorn lunaryorn referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@rafaeln

It's a bummer this issue has been closed. I used vim-latex and I wish it were only the folding I'd lose if I stopped using it. For one, I'd lose reference auto-completion and the macros for adding bibliography items and enclosing stuff inside environments. I'd also lose the compile-as-many-times-as-necessary-to-get-the-work-done thing, as well as pdf-syncing, and so much more stuff that is already set and would be a bummer to have to do reimplement all. I mean, if there is no other solution, I can just keep doing :diffthis on both windows and then I'm done, right? Or would I be losing anything from the :Gdiff?

@cowlicks

note: @0's link is broken. Correct link to Tex_pack_updateall

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.