Tuesday, February 26, 2013

Re: Always restore buffer list from .viminfo file

I use the following lines in my .vimrc…

> " Auto save/load session
> function! CheckSessionFile()
> if filereadable(expand("$HOME/.vim/session/default.vim"))
> source $HOME/.vim/session/default.vim
> endif
> endfunction
>
>
> if has('gui_running')
> autocmd VimLeave * mksession! $HOME/.vim/session/default.vim
> autocmd VimEnter * nested call CheckSessionFile()
> autocmd * SessionLoadPost source $MYVIMRC
> endif

This automatically saves a session when GUI Vim leaves and loads the session file if it exists on start up. It may not work well for you since it sounds like you're always in terminal Vim but I thought I'd pass it along.

-Adrian

On Feb 20, 2013, at 1:26 AM, Arvid Warnecke <arvid@nostalgix.org> wrote:

> Hello,
>
> is there any chance to recover all opened buffers in vim from the
> ~/.viminfo file somehow?
> I understood that vim trashes the buffers list when vim is started with
> a specific file to edit. But as I use vim in mutt as my default editor
> as well, I always loose my buffers because mutt opens it like this:
>
> `vim /tmp/mutt-archbookPro-1000-895-3021467551525290154`
>
> So it does not help when I try to use only one vim instance running on
> my workstation to keep all buffers around.
>
> I read something about v:oldfiles, but I have no clue how this file
> might be of any help, because I just have a list of all old files in a
> new buffer. I am not able to restore the buffers from it.
>
> Best regards,
> Arvid
>
> --
> [ Arvid Warnecke ][ arvid (at) nostalgix (dot) org ]
> [ IRC/OPN: "madhatter" ][ http://www.nostalgix.org ]
> ---[ ThreePiO was right: Let the Wookiee win. ]---

--
--
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/groups/opt_out.

No comments:

Post a Comment