Support Mac resume feature

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Support Mac resume feature

Penn Su
In Mac since Lion I believe, they introduced the resume feature that would let apps to resume the windows, and the unsaved documents state before quitting. I wish macvim could also implement this feature so that whatever windows or buffers, tabs that I have opened in macvim could be resume if I accidentally quit the app.

Thanks.

--
--
You received this message from the "vim_mac" 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_mac" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Support Mac resume feature

dv1445
On Wed, Oct 23, 2013 at 08:49:03AM -0700, Penn Su wrote:
> In Mac since Lion I believe, they introduced the resume feature that would let apps to resume the windows, and the unsaved documents state before quitting. I wish macvim could also implement this feature so that whatever windows or buffers, tabs that I have opened in macvim could be resume if I accidentally quit the app.

This has been requested before.  That functionality can be mimicked from within vim by using various options and perhaps autocommands for some special occasions.  Start by looking at ":help autowriteall", which should do what you want for the case of accidental closure.  For automatic reopening of windows, look at ":h sessions", which would almost certainly work much better wrt to Vim than Apple's version anyway.

I sure hope the Apple implementation of this doesn't get put into MacVim.

-gmn

--
--
You received this message from the "vim_mac" 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_mac" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Support Mac resume feature

Björn Winckler
On Thu, Oct 24, 2013 at 5:35 PM,  wrote:
> On Wed, Oct 23, 2013 at 08:49:03AM -0700, Penn Su wrote:
>> In Mac since Lion I believe, they introduced the resume feature that would let apps to resume the windows, and the unsaved documents state before quitting. I wish macvim could also implement this feature so that whatever windows or buffers, tabs that I have opened in macvim could be resume if I accidentally quit the app.
>
> This has been requested before.  That functionality can be mimicked from within vim by using various options and perhaps autocommands for some special occasions.  Start by looking at ":help autowriteall", which should do what you want for the case of accidental closure.  For automatic reopening of windows, look at ":h sessions", which would almost certainly work much better wrt to Vim than Apple's version anyway.
>
> I sure hope the Apple implementation of this doesn't get put into MacVim.

Yeah, I think the consensus was that Apple's implementation is
inferior in the case of Vim.

That being said.  Configuring Vim to autosave documents probably
requires a PhD in Vim script, whereas the resume feature in other apps
is automatic.  It would be nice to have something in MacVim that was
as easy to use.

Björn

--
--
You received this message from the "vim_mac" 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_mac" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Support Mac resume feature

Tony Mechelynck
On Friday, October 25, 2013 8:39:40 PM UTC+2, björn wrote:

> On Thu, Oct 24, 2013 at 5:35 PM,  wrote:
>
> > On Wed, Oct 23, 2013 at 08:49:03AM -0700, Penn Su wrote:
>
> >> In Mac since Lion I believe, they introduced the resume feature that would let apps to resume the windows, and the unsaved documents state before quitting. I wish macvim could also implement this feature so that whatever windows or buffers, tabs that I have opened in macvim could be resume if I accidentally quit the app.
>
> >
>
> > This has been requested before.  That functionality can be mimicked from within vim by using various options and perhaps autocommands for some special occasions.  Start by looking at ":help autowriteall", which should do what you want for the case of accidental closure.  For automatic reopening of windows, look at ":h sessions", which would almost certainly work much better wrt to Vim than Apple's version anyway.
>
> >
>
> > I sure hope the Apple implementation of this doesn't get put into MacVim.
>
>
>
> Yeah, I think the consensus was that Apple's implementation is
>
> inferior in the case of Vim.
>
>
>
> That being said.  Configuring Vim to autosave documents probably
>
> requires a PhD in Vim script, whereas the resume feature in other apps
>
> is automatic.  It would be nice to have something in MacVim that was
>
> as easy to use.
>
>
>
> Björn

You could use

        :au VimLeave mks!

then create a desktop shortcut to start Vim with the -S switch, which hardly requires a PhD in Vim scripting. It does assume that your Vim executable has been compiled with +autocmd and +mksession. The only problem AFAIK would be which value to set for 'sessionoptions' (q.v.) to get all you need and avoid unneeded duplication of code with, for instance, your vimrc.

Or if (like me) you want to start Vim almost every time with the same files in the same windows and tabs, you could write a session script manually, with whatever ex-commands you would like to see Vim run after sourcing your vimrc, in order to load your "usual" session, bypassing :mksession entirely. The reason you might want to keep these commands out of your vimrc would ve so that you could run Vim from time to time with no saved session.

See
        :help :version
        :help VimLeave
        :help :mksession
        :help -S
        :help 21.4
        :help views-sessions
        :help 'sessionoptions'

Best regards,
Tony.
--
With a gentleman I try to be a gentleman and a half, and with a fraud I
try to be a fraud and a half.
                -- Otto von Bismark

--
--
You received this message from the "vim_mac" 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_mac" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.