Ver código fonte

Prune arglist before saving sessions

:mksession saves opened buffers and files listed in the arglist.

Assuming you would do:

    $ vim foo bar
    :SS session
    :x
    $ vim
    :SL session
    :bwipeout bar
    :x

In that case the only file left in the session should be 'foo'. But
that's not the case, since :mksession! also saves the argument list,
which still consists of 'foo' and 'bar'. Next time you load the session,
both buffers would be opened again.

But since the argument list is seldomly used, or at least not with the
arguments that were given to Vim, it will be pruned from now on.

References #106.
Marco Hinz 11 anos atrás
pai
commit
1765f6b6bb
1 arquivos alterados com 2 adições e 0 exclusões
  1. 2 0
      autoload/startify.vim

+ 2 - 0
autoload/startify.vim

@@ -219,6 +219,8 @@ function! startify#session_write(spath)
   let ssop = &sessionoptions
   try
     set sessionoptions-=options
+    " prevent saving already deleted buffers that were in the arglist
+    silent! argdelete *
     execute 'mksession!' a:spath
   catch
     execute 'echoerr' string(v:exception)