There are two examples on vim_use list:
What happens is that mksesion!
does not honor bdelete!
.
Full working example:
/tmp/abcde » touch a b buffer_to_be_deleted
/tmp/abcde » vim -p a b buffer_to_be_deleted
3 files to edit
--------------------- Inside Vim ---------------------
bd buffer_to_be_deleted
mksession! /tmp/session.vim
buffers
:buffers
1 %a "a" line 1
2 a "b" line 0
--------------------- Outside Vim ---------------------
/tmp/abcde »
/tmp/abcde » ls
a b buffer_to_be_deleted
/tmp/abcde » vim -S /tmp/session.vim
--------------------- Inside Vim ---------------------
buffers
:buffers
2 %a "a" line 1
3 "b" line 1
4 a "buffer_to_be_deleted" line 0
--------------------- Outside Vim ---------------------
I would not expect the line
4 a "buffer_to_be_deleted" line 0
to be there.
This happens with sessionoptions
including 'buffers' and without.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
This happens because buffer_to_be_deleted is in the argument list. When the session is loaded and the argument list is re-created the buffer is also added.
We could add the buffer in hidden state to avoid the problem.
You can clear the arglist (:argd *) before executing mksession. If you want to restore the arguments to the arglist, you could write a little script that saves the array of args (use 'argv()' in vimscript), perform the arglist clear, then set args to the saved array.