You can further tinker this idea:

au BufNewFile * set cpo += '&'|preserve  " preserve swap file
au BufWritePost * set cpo -= '&'

This will preserve swap files of every buffer that was not saved.

Best,
Marcin

On 11:41 Sat 12 Oct     , Calon wrote:
> That doesn't work to unsaved buffer, will write copy to backup file only
> when save to original file.
> 
> For example ("backup", "backupdir" already set in vimrc file.):
> First, open a new buffer, write something.
> Now there will be a temporary swap file in the swap directory, just like
> .swp
> Then delete this buffer, choose dot not save buffer.
> The swap file will disappear, no backup or undo file created or left.
> 
> The plugin/feature I'm searching for is that it can generate another type
> of backup file for unsaved buffer, like another permanent and readable swap
> file.
> So you can still get regret pill after exit without saving a temporary file.
> 
> 
> On Fri, Oct 11, 2013 at 7:10 PM, Ben Fritz <fritzophre...@gmail.com> wrote:
> 
> > On Friday, October 11, 2013 5:33:54 AM UTC-5, Calon wrote:
> > > Is there any plugin that can auto save backup file to specified
> > directory before saving a buffer to file (EmEditor has this great feature),
> > or any option to keep swap file after normal exit?
> > >
> > >
> > >
> > >
> > >
> > > Currently, I can get auto saved swap or backup file only after vim crash
> > or saving to disk.
> >
> > :help 'backup'
> > :help 'backupdir'
> >
> > --
> > --
> > 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+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/groups/opt_out.
> >
> 
> -- 
> -- 
> 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+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to