0

Somehow vim remembers that I did vimdiff on certain files and keeps opening them in the vimdiff mode. What that means is that when I open that same file again I get a grey bar displayed on the left (like the foldcolumn) but worse when I try to add another file with :sp anotherfile.txt it comes up in a full on diff mode - interlocked, diff highlighted, etc.

It's completely as if I opened the first file with vimdiff somefile.txt, yet I didn't. I opened it with vim somefile.txt and it still behaves like vimdiff, only because in the past I opened it with vimdiff. It's very annoying.

Why does it happen?

KeepLearning
  • 349
  • 2
  • 3
  • 10

1 Answers1

2

Ok, found it. I added these to my /.vimrc a couple weeks ago:

autocmd BufWinLeave *.* mkview
autocmd BufWinEnter *.* silent loadview

Now whenever I used vimdiff it created a vimdiff view for the particular file and then reloaded it the next time I opened the file.

That was quite unintended for vimdiff. I'll have to have a look how to activate mkview only for plain vim and not for vimdiff.

KeepLearning
  • 349
  • 2
  • 3
  • 10
  • 1
    Something like `autocmd BufWinEnter *.* if &diff != 'diff' | silent loadview | endif` – phd Jul 10 '19 at 16:26