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?

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Something like autocmd BufWinEnter *.* if &diff != 'diff' | silent loadview | endif

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.