I'm creating a session with mksession, and when I restore the session, if the first tab was empty ([No Name]), it's gone in the restored session. Other empty tabs are restored fine; it seems to only be the first tab that's lost. If there are multiple "leading" empty tabs, it's still only the first one that disappears.

I'm using this with vim -u NONE so there is zero config and no plugins, but I get the same behavior with my normal config. Affects versions 7.3 and 8.0.52.

I'm using the default sessionoptions in all cases: blank,buffers,curdir,folds,options,tabpages,winsize.

Steps to reproduce:

  • $ vim -u NONE
  • :tabnew
  • :e foo.txt
  • :w
  • :tabnew
  • :mksession
  • :qa
  • $ vim -u NONE -S Session.vim

The tabline now shows foo.txt | [No Name]. Expected [No Name] | foo.txt | [No Name].

Is this a known issue? Is there a workaround?

  • 1
    I can confirm it behaves like this. Sounds like a bug? This is probably best reported to the vim_dev list or the GitHub issue tracker. Commented Nov 24, 2016 at 12:12
  • I'll report it on both and look into a fix. I use a plugin I wrote which uses fixed, labeled tabs so this messes with my workflow a bit. Commented Nov 24, 2016 at 14:35

1 Answer 1


This is indeed a bug in Vim. I filed a GitHub issue, and someone on the vim-dev mailing list addressed it.

Here's a patch that fixes it in Vim 8.0.52:

diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 439467c..ca4133a 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -11091,6 +11091,8 @@ makeopens(
        if (tabnr > 1)
        need_tabnew = TRUE;
+       else if (put_line(fd, "new") == FAIL)
+       return FAIL;


Patch courtesy Hirohito Higashi on the vim-dev mailing list. I imagine it will make its way into the official distribution.


This was fixed in Vim 8.1.0149 (see GitHub PR).

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.