Friday, February 5, 2016

Re: unexpected sessionman behaviour

2016-02-05 14:51 GMT+03:00 <christoph.kliemt@pgxml.net>:
> Hi,
>
> recently i installed sessionman and for a while i was quite happy with
> it, but then i discovered something i dislike:
>
> Open some files, edit them, and have some changes unsaved. Then open a
> saved session with sessionman. Result: The old session is restored,
> unsaved changes to the previously edited buffers are gone.
>
> I had a look at sessionman.vim and it seems that sessionman wipes out
> all open buffers when it opens a (saved) session.
>
> Is there a way to have vim ask me: Hey, you have saved changes:
> discard or save? Or do i have to hack sessionman.vim?

Wiping out buffers by default makes Vim ask this. If sessionman.vim
wipes buffer using command with bang, it explicitly tells Vim to
ignore &modified option value (which is set when unsaved changes are
present). So you will either have to hack sessionman.vim or write your
wrapper which iterates over all buffers and checks whether &modified
is true.

You can check this using the following expression

!empty(filter(range(1, bufnr('$')), 'bufexists(v:val) &&
getbufvar(v:val, "&modified)'))

>
> regards,
>
> Christoph
>
> --
> --
> You received this message from the "vim_use" 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
>
> ---
> You received this message because you are subscribed to the Google Groups "vim_use" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
--
You received this message from the "vim_use" 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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment