Vim: Delete Buffer When Quitting Split Window?

Bwipeout! N1 N2 ... Like |:bdelete|, but really delete the buffer. Everything related to the buffer is lost.

All marks in this buffer become invalid, option settings are lost, etc. Don't use this unless you know what you are doing One option would be to define the following: function! DelBuf(filename) let bname = bufname(filename) if l:bname! = "" let bidx = buffer_number(l:bname) exec = "bw " .

L:bidx endif endfunction and add a call to DelBuf("comapre. Tmp") at the beginning of your function In theory it should be possible to bind DelBuf to the `bufhidden event like this: autocmd! Bufhidden "compare.

Tmp" call DelTmp("compare. Tmp") but for some reason it didn't work for me.

Bwipeout! N1 N2 ... Like |:bdelete|, but really delete the buffer. Everything related to the buffer is lost.

All marks in this buffer become invalid, option settings are lost, etc. Don't use this unless you know what you are doing. One option would be to define the following: function! DelBuf(filename) let bname = bufname(filename) if l:bname!

= "" let bidx = buffer_number(l:bname) exec = "bw " . L:bidx endif endfunction and add a call to DelBuf("comapre. Tmp") at the beginning of your function.

In theory it should be possible to bind DelBuf to the `bufhidden event like this: autocmd! Bufhidden "compare. Tmp" call DelTmp("compare.

Tmp") ... but for some reason it didn't work for me.

OK, thank you for this comment, it is helpful, but it is not what I am asking for. See, the problem is that the buffers seem to be separated from the windows. So when you quit a window, you don't remove the buffer it was editing.

I am wondering whether this is possible. – Promather Dec 24 '10 at 20:05 You need to use vim autocmd with the event Bufdden to automatically run the :bw command. This event is triggered when the buffer is no longer visible (i.e.

, all windows related to this buffer are closed). – nimrodm Dec 24 '10 at 20:13.

You need to use autocmd winleave bd (buffer delete). Be warned that if you have the buffer open in more than one window they will all be removed.

I usually define the following things for diff-buffers: setlocal bt=nofile bh=wipe nobl noswf ro nnoremap q :bw The first line is what will make the difference in your case (:h 'bh' -> no need for a single execution autcocommand), the second line is just a shortcut. BTW: use r! Git instead of producing a temporary file.

This way, you won't have to clear that file either.

What it does is basically opening the file I am currently working on from repository in a vertical split window, then compare with it. This is very handy, as I can easily compare changes to the original file. However, there is a problem.

After finishing the compare, I remove the split window by typing :q. This however doesn't remove the buffer from the buffer list and I can still see the compare. Tmp file in the buffer list.

Warning: File "temp/compare. Tmp" has changed since editing started. Is there anyway to delete the file from buffers as well as closing the vertical split window?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions