Re: Extra [No Name] Buffers from mksession

2006-10-21 Thread Bram Moolenaar

Bill McCarthy wrote:

 When I open a session created by mksession, a [No Name]
 buffer is created for each tab that is created.  My
 'sessionoptions' contains all the options except sesdir,
 slash and unix.  I checked buffers with 'ls!' before saving
 the session.  I startup with:
 
 gvim -S session_file_name.vim
 
 In the session file, each tab is created and filled with
 
 tabnew
 edit file
 
 Trying that same sequence in a .vim file like this
 
 edit file 1
 tabnew
 edit file 2
 tabnew
 edit file 3
 tabnew
 edit file 4
 
 And then sourcing it with:
 
 gvim +so myfile.vim
 or
 gvim -S myfile.vim
 
 does not generate any [No Name] files in ls!.  It generates
 3 of those files when I save that session and load it later.
 
 I am running gvim 7.0.136 on Windows XP Pro with all
 updates.

This happens when the edited file already is in the buffer list.
I'll fix it by using tabedit instead of tabnew | edit.

-- 
hundred-and-one symptoms of being an internet addict:
91. It's Saturday afternoon in the middle of May and you
are on computer.

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\download, build and distribute -- http://www.A-A-P.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///


Re: Extra [No Name] Buffers from mksession

2006-10-21 Thread Bill McCarthy
On Sat 21-Oct-06 6:59am -0600, Bram Moolenaar wrote:

 This happens when the edited file already is in the buffer list.
 I'll fix it by using tabedit instead of tabnew | edit.

Ah, thanks for explaining that.  I knew that making that
replacement solved the problem but didn't know why.

I had used a shell script to fix the problem.  Since I don't
know how to do a multi-line replace is SED, I used console
Vim as a super SED!  The one-liner is simply:

vim -u NONE -i NONE -Nnes +%%s/tabnew\nedit/tabedit/|wq %1

where '%1' is the placeholder for the sessionfile and '%%s'
is needed in 4nt because '%s' would be thought of as an
environment variable.  This was an interesting and
productive exercise, because it taught me how to use console
Vim as a very powerful batch tool (I had never used the
'-es' combo before).

This afternoon, I wrote a ':command' to do this within Gvim
(or Vim) for my _vimrc:

com! -narg=1 MS mks! args
\|sil sp args
\|sil %s/tabnew\nedit/tabedit/
\|sil w
\|bw
\|redr!
\|echohl Warning
\|echomsg Session saved using tabedit
\|echohl NONE

This works fine.

One last question is how can I get my restored session to
have buffer numbers 1 - n instead of 2 - n+1 (which is the
way mksession does things)?

-- 
Best regards,
Bill



Extra [No Name] Buffers from mksession

2006-10-20 Thread Bill McCarthy
Hello Vim List,

When I open a session created by mksession, a [No Name]
buffer is created for each tab that is created.  My
'sessionoptions' contains all the options except sesdir,
slash and unix.  I checked buffers with 'ls!' before saving
the session.  I startup with:

gvim -S session_file_name.vim

In the session file, each tab is created and filled with

tabnew
edit file

Trying that same sequence in a .vim file like this

edit file 1
tabnew
edit file 2
tabnew
edit file 3
tabnew
edit file 4

And then sourcing it with:

gvim +so myfile.vim
or
gvim -S myfile.vim

does not generate any [No Name] files in ls!.  It generates
3 of those files when I save that session and load it later.

I am running gvim 7.0.136 on Windows XP Pro with all
updates.

-- 
Best regards,
Bill