Jorge Almeida wrote:
On Wed, 6 Sep 2006, A.J.Mechelynck wrote:
The viminfo file holds mark positions for a finite number of files. How many

Yes, that's what I suspected.
After "vim -S vimbook.vim" I don't think it will be updated at exit, UNLESS
you add the following to your vimrc:

        :au VimLeave *
                \ if exists("v:this_session")
                \ && v:this_session != ""
                \ |     exe "mksession" v:this_session
                \ | endif

Not quite satisfactory... I wanted to save a session file only for the
text files read via the script I mentioned (and they don't have a
particular filetype). What would be really handy is a feature like the
-c flag, but to execute a command at the _end_ of the session. I don't
suppose there is such a feature, at least I couldn't find it in vim's
unix man page.
On the other hand... Could the above script (":au...") be modified to be
executed only if some variable was set? I mean, some variable that could
be set at start time via -c ? That would allow to filter out files not
read via the script...
(Sorry if this is trivial, but I'm not a _real_ programmer!)

Thanks,

Jorge

To do something when closing down, place it in an autocommand for the VimLeave autocommand (as above). To do it during startup, place it in your vimrc. To do it at the cery end of startup, put it in an autocommand dor the VimEnter autocommand. And read the help (not the man page) if you can: for some reason my Vim won't read the help for me at this time.

If you want to always start with the same session files, use ":mksession" once (see ":help mksession") and maybe make an alias: "alias vim='vim -S ~/session.vim'" in your shell.


Best regards,
Tony.

Reply via email to