I have this very useful function in my .vimrc:
function! MyGitDiff()
diffthis
belowright vertical new
edit temp/compare.tmp
diffthis
endfunction
What he does is basically open the file in which I am currently working from the repository in a vertically split window, and then compare it. This is very convenient, since I can easily compare the changes with the source file.
However, there is a problem. At the end of the comparison, I delete the split window by typing: q. This, however, does not remove the buffer from the buffer list, and I still see the compare.tmp file in the buffer list. This is annoying because whenever I make a new comparison, I get this message:
Warning: the file "temp / compare.tmp" has changed since the start of editing.
Is there a way to remove a file from buffers and also close the vertical split window?