Monday, August 29, 2011

Re: storing variables in viminfo

On Aug 29, 2:04 pm, Tony Mechelynck <antoine.mechely...@gmail.com>
wrote:
> On 29/08/11 10:36, sinbad wrote:
>
>
>
>
>
>
>
>
>
> > On Aug 29, 1:29 pm, "Christian Brabandt"<cbli...@256bit.org>  wrote:
> >> On Mon, August 29, 2011 10:06 am, sinbad wrote:
> >>> my viminfo setting is viminfo='20,"50,! and my variable name is
> >>> g:MYLIST
> >>> i am running vim 7.0. even after the above settings the variable is
> >>> not saved
> >>> am i missing anything else.
>
> >> Storing dictionaries or lists is only supported with Vim 7.3.030
>
> >> regards,
> >> Christian
>
> > hi J rgen,
>
> > Actually it is a list. As storing lists doesn't seem to be supported
> > in vim 7.0
> > is there any workaround for this, besides installing latest vim.
> > as this is office server, i have to install it locally. and i faced
> > many lib issues while doing that (latest vim requires latest ncurses,
> > termlib ...)
> > etc.
>
> > thanks
>
> You can convert it back and forth to a string:
>
> if has('viminfo') && has('autocmd')
>         set vi^=!
>         au VimEnter *
>                 \ if exists('MYLIST_STR')
>                         \ | let MyList = eval(MYLIST_STR)
>                 \ | else
>                         \ | unlet! MyList
>                 \ | endif
>         au VimLeavePre *
>                 \ if exists('MyList')
>                         \ | let MYLIST_STR = string(MyList)
>                 \ | else
>                         \ | unlet! MYLIST_STR
>                 \ | endif
> endif
>
> Best regards,
> Tony.
> --
> Think of your family tonight.  Try to crawl home after the computer
> crashes.

Brilliant, It works perfect, thanks a lot Jürgen and Tony.

--
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

No comments: