Note: Possible fixed bug. See comments.

A somewhat minor nuisance, but as the pedantic for these things :P

When saving and opening a Session file the Session.vim file does:

badd +1 file1
badd +1 file2
badd +1 file3

This result in buffer numbering starting with 2 instead of 1.

:ls after opening Session file

I notice some Session files use badd +0 instead of badd +1, but this does not make any difference.

One way to circumvent this is to comment out first file in the session file and open Vim by:

vim file1 -S Session.vim

Is there a way to do this in the session-file instead?

I have tried to replace badd with edit for first file in Session.vim, but that does not work. (File does not get opened at all.)

VIM 8.0 patches: 1-1453


Also tested with vim -u NONE -S

  • 1
    I do not see it. What is your vim version? – Christian Brabandt Sep 9 '19 at 16:34
  • @ChristianBrabandt: Debian/Ubuntu pkg. VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jun 06 2019 17:31:41) Included patches: 1-1453 – user3342816 Sep 9 '19 at 16:46
  • can you please check with a more uptodate version? – Christian Brabandt Sep 9 '19 at 16:47
  • @ChristianBrabandt: I compiled my own on previous Ubuntu as there was some irritating bugs they were slow to include (released) fixes for. Perhaps I have to do it here as well. – user3342816 Sep 9 '19 at 16:52
  • @ChristianBrabandt: I do not have the time to do it now. Have wasted too much time on this rabbit-hole heh. I can do it later and report back if you want. – user3342816 Sep 9 '19 at 16:59

I could achieve that by moving the edit line from the middle of the session file to the first line of the file. Ugly, I'd say...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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