I'm seeing this problem too, and find that the recommended ':bufdo diffoff' does not work.
As I am seeing it, it is like this:
At this point, buffers seem to have almost all lines highlighted as having differences, even then they are identical. Doing a ':diffoff' on one of them, shows the other still has all lines 'different' to something.
This is where I conclude it is diffing with one of the buffers that is longer visible, so I am wondering how to turn diff off on everything, so I can 'start again', so to speak.
My searches suggest ':bufdo diffoff' would work, but no; similarly for 'bufdo diffoff!'.
If I 'think ahead', and run ':diffoff' on the buffers before I switch to new files, then all works as expected, but I am still open to forgetting to do that, at which point I am wishing there was a way to turn diff off completely, even on non-visible buffers.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
:bufdo diffoff should have worked, while :diffoff! only disables diff mode in buffers still visible in any windows. However I cannot imagine, why :bufdo :diffoff did not work. Perhaps those buffers weren't listed anymore? I think then the :bufdo command would skip those buffers. Perhaps the :diffoff! command should turn off diff mode for all buffers that exist, regardless of whether they are shown in a window.
Hrm, is it :bufdo :diffoff, with an extra colon? I'll have to try when I'm next in my computer.
Oh hey, it's my old bug! I once spent hours staring at vim's data structures with gdb, couldn't figure it out.
@davidmaxwaterman what's your Vim version? I personally haven't triggered this bug in a long time, and I don't think it's just because I'm now always careful to :diffoff before I switch buffers in a window.
(:bufdo :diffoff should be exactly the same as :bufdo diffoff -- vim allows extra : in front of ex command names.)
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Mar 17 2017 12:13:35)
seems 'quite' recent - it's straight from ubuntu's repos:
05:09:27 ~$ dpkg -l | grep vim
ii vim 2:8.0.0095-1ubuntu3 amd64 Vi IMproved - enhanced vi editor
ii vim-common 2:8.0.0095-1ubuntu3 all Vi IMproved - Common files
ii vim-gnome 2:8.0.0095-1ubuntu3 all Vi IMproved - enhanced vi editor (dummy package)
ii vim-gtk3 2:8.0.0095-1ubuntu3 amd64 Vi IMproved - enhanced vi editor - with GTK3 GUI
ii vim-gui-common 2:8.0.0095-1ubuntu3 all Vi IMproved - Common GUI files
ii vim-runtime 2:8.0.0095-1ubuntu3 all Vi IMproved - Runtime files
ii vim-tiny 2:8.0.0095-1ubuntu3 amd64 Vi IMproved - enhanced vi editor - compact version
05:09:32 ~$
The 'diff' option is window-local, thus using :bufdo doesn't do the right thing. You want to use ":diffoff!", that's the only way to remove hidden buffers from diff mode. Diff mode allows for diffing against hidden buffers. It's sometimes useful, but it also creates this confusion.
Okay, so :diffoff! should fix it finally. Now I really wonder what happened, that this did not work. I just made a quick test with three buffers and could not reproduce that behaviour, playing around with hidden and buflisted options. @davidmaxwaterman can you give a reproducible example?
diffoff! seems to fix it for me.
This is how I tested it:
cd
mkdir tmp
cd tmp
for i in $(seq 4); do echo $i > $i.txt; done # make some files to diff
vim
:Ex # select 1.txt
ctrl-Wv
ctrl-Wctrl-W
:Ex # select 2.txt
:diffthis
ctrl-Wctrl-W
:diffthis
# at this point it is showing diffs for my first pair of files
# now I want to switch to diffing [34].txt - this is where I will do ':diffoff!' from now on
:Ex # select 3.txt
ctrl-Wctrl-W
:Ex # select 4.txt
:diffthis # at this point, we can already see it is diffing this file with [12].txt
ctrl-Wctrl-W
:diffthis # now diffing [1234].txt?
To be honest, I should have thought of adding the '!'.
Okay, I take that as being a confirmation, that the problem is actually resolved :)