On 20/04/12 19:07, Daan van Rossum wrote:
Hi all,

Description:
  Vim's restore session mechanism doesn't restore the buffer numbers properly.  
Buffer #1 is skipped and the buffers in Session.vim are appended to it, so they 
start at #2.


Version:
  7.3.495


References to the same problem:
  
http://larig.wordpress.com/2012/02/14/vim-sessions-and-the-missing-first-buffer/


Reproduce problem:
  vim a b
   :ls
   :mksession
   :qa
  vim -S
   :ls


Possible solution:
  Add a workaround-function, say :bfrom1, that shifts all buffer numbers one 
position to the left if the first buffer is wiped-out.  This fuction can then 
be called in Session.vim after wiping buffer #1:
   if exists('s:wipebuf')
     silent exe 'bwipe ' . s:wipebuf
     bfrom1
   endif


Best,
Daan



AFAIK buffer numbers are not meant to persist between sessions, even efter ":mksession" ":quit" "vim -S" — if you've used :bwipeout there are "holes" in the list of buffer numbers; after reload those holes are not preserved.

What is supposed to be preserved are buffer names (and full paths for buffers whose 'buftype' is not "nofile") and windows.


Best regards,
Tony.
--
Most fish live underwater, which is a terrible place to have sex
because virtually anywhere you lie down there will be stinging crabs
and large quantities of little fish staring at you with buggy little
eyes.  So generally when two fish want to have sex, they swim around
and around for hours, looking for someplace to go, until finally the
female gets really tired and has a terrible headache, and she just
dumps her eggs right on the sand and swims away.  Then the male, driven
by some timeless, noble instinct for survival, eats the eggs.  So the
truth is that fish don't reproduce at all, but there are so many of
them that it doesn't make any difference.
                -- Dave Barry, "Sex and the Single Amoeba: What Every
                   Teen Should Know"

--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui