tabs and session trouble

9 views
Skip to first unread message

Percy Foreman

unread,
Nov 4, 2008, 7:55:04 AM11/4/08
to vim...@googlegroups.com
Hi all,

I've been trying to incorporate tabs in my workflow, but have trouble
saving them in a session. I usually start with an existing session,
make new tabs and source different sessions into each of the tabs.
Then I save a new session-file, hoping it will remember all my tabs.

But it doesn't. When I exit vim and fire up the newly created session,
I find that all the files are there, but all the tabs are gone.
Searched google, but "tabs" seems to be too popular to get a correct
answer.

Thanks,
Percy

fritzophrenic

unread,
Nov 4, 2008, 10:46:24 AM11/4/08
to vim_use
I personally have found the support for tabs in sessions for the
Windows version of Vim to be so abysmal that I do not use sessions at
all.

This is okay for me, because I often end my Vim sessions with many
buffers loaded that I will probably not need the next time I start up
Vim. For my purposes, the excellent MRU plugin is all I need (though I
really need to increase the number of files remembered again...)

Charles Campbell

unread,
Nov 4, 2008, 2:34:29 PM11/4/08
to vim...@googlegroups.com
I don't often make tabs and sessions -- but I just tried making a
session with three tabs, one of which was a split window. Did the
:mksession somefile.ses, exited, and gvim -S somefile.ses, and it was
restored correctly. Does your sessionoptions setting have "tabpages" in it?

Regards,
Chip Campbell

fritzophrenic

unread,
Nov 4, 2008, 2:53:25 PM11/4/08
to vim_use


On Nov 4, 1:34 pm, Charles Campbell <Charles.E.Campb...@nasa.gov>
wrote:
>
> I don't often make tabs and sessions -- but I just tried making a
> session with three tabs, one of which was a split window.  Did the
> :mksession somefile.ses, exited, and  gvim -S somefile.ses, and it was
> restored correctly.  Does your sessionoptions setting have "tabpages" in it?
>
> Regards,
> Chip Campbell- Hide quoted text -
>

My sessionoptions does include "tabpages" (I leave it at the default).

I should mention that I have never tried sessions with tabs and
without my plugins/autocmds. I would advise the OP to try making a
session in a Vim launched with the -N and -u NONE options, and then
restore the session in a Vim launched in the same fashion.

I suspect that my use of the TagList plugin, and my autocmds to
automatically open it for certain file types, but only if the file in
question is displayed in the only window in the tab, may be at fault
for the problems I have seen. As I have said, the MRU plugin suits my
needs just fine, so I have no real motivation to track down the
culprit.

Percy Foreman

unread,
Nov 4, 2008, 3:24:39 PM11/4/08
to vim...@googlegroups.com
"Charles Campbell" <Charles.E...@nasa.gov>:

I did not have a "sessionoptions"-setting in my .vimrc. I just changed it to

set ssop="blank, buffers, curdir, folds, help, options, winsize, tabpages"

but get the same result.

Charles Campbell

unread,
Nov 4, 2008, 3:42:38 PM11/4/08
to vim...@googlegroups.com
As Fritzophrenic pointed out, plugins apparently have the potential to
interfere. Try:

vim -u NONE
(:set nocp, set up tabs and whatnot)
:mks! ses.S
:q

If that works (vim -S ses.S), try

vim --noplugin
(same as above)

If the first case worked, then there's likely to be a conflict with
something in your .vimrc or plugins. If the second case works, that'll
narrow it down to your plugins. Further narrowing is an exercise in
disabling plugins and re-enabling them.

Regards,
Chip Campbell

fritzophrenic

unread,
Nov 4, 2008, 4:11:36 PM11/4/08
to vim_use


On Nov 4, 2:42 pm, Charles Campbell <Charles.E.Campb...@nasa.gov>
wrote:
>
> As Fritzophrenic pointed out, plugins apparently have the potential to
> interfere.  Try:
>
> vim -u NONE
>   (:set nocp, set up tabs and whatnot)
>   :mks! ses.S
>   :q
>
> If that works  (vim -S ses.S), try
>
> vim --noplugin
>   (same as above)
>
> If the first case worked, then there's likely to be a conflict with
> something in your .vimrc or plugins.  If the second case works, that'll
> narrow it down to your plugins.  Further narrowing is an exercise in
> disabling plugins and re-enabling them.
>
> Regards,
> Chip Campbell

After some _very_ brief experimentation, I determined that on my
setup :mksession works if I do not have the Taglist window open, and
all the files are in the same directory. It also works with gvim -N -u
NONE.

This leads me to believe that the TagList plugin does not work well
with mksession, and that the autochdir option also causes problems.

I might sometime play with this some more, if I feel the need to make
a session file, but it's good enough for me for now.

Rebecca Poole

unread,
Nov 4, 2008, 5:52:04 PM11/4/08
to vim...@googlegroups.com


I found out that it wasn't one of my plugins, but rather my vimrc. I
disabled a couple
of things and then it worked. But then I enabled them again and it
worked as well (???).
So I'm afraid I can't really narrow it down. I've moved all my plugins
out of my plugin-
directory and moved them in again, does it re-initalize them maybe? I
don't have a clue.
Nevertheless, here are the things that I believed caused the problem
(either/or):


-----------------------------------------
set viminfo='100,f1

augroup JumpCursorOnEdit
au!
autocmd BufReadPost *
\ if expand("<afile>:p:h") !=? $TEMP |
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ let JumpCursorOnEdit_foo = line("'\"") |
\ let b:doopenfold = 1 |
\ if (foldlevel(JumpCursorOnEdit_foo) >
foldlevel(JumpCursorOnEdit_foo - 1)) |
\ let JumpCursorOnEdit_foo = JumpCursorOnEdit_foo - 1 |
\ let b:doopenfold = 2 |
\ endif |
\ exe JumpCursorOnEdit_foo |
\ endif |
\ endif
" Need to postpone using "zv" until after reading the modelines.
autocmd BufWinEnter *
\ if exists("b:doopenfold") |
\ exe "normal zv" |
\ if(b:doopenfold > 1) |
\ exe "+".1 |
\ endif |
\ unlet b:doopenfold |
\ endif
augroup END

au BufWinLeave ?* mkview
au BufWinEnter ?* silent loadview
-----------------------------------------

Because that's every entry that could remotely affect this behaviour. My
vimrc is not
very big.
--
Rebecca Poole
arta...@fastmail.fm

--
http://www.fastmail.fm - Does exactly what it says on the tin

Reply all
Reply to author
Forward
0 new messages