Monday, August 29, 2011

Re: storing variables in viminfo

Hi,

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

use an additional variable g:MYLISTASSTRING which you keep synchronized
with g:MYLIST by executing

:let g:MYLISTASSTRING = string(g:MYLIST)

whenever g:MYLIST is changed. It might also be enough to define an
autocommand which syncs these variable just before Vim is quit:

:autocmd VimLeavePre * let g:MYLISTASSTRING = string(g:MYLIST)

(I haven't tested this).

On startup of Vim you can initialize g:MYLIST from g:MYLISTASSTRING with

if exists('g:MYLISTASSTRING')
let g:MYLIST = eval(g:MYLISTASSTRING)
endif

Regards,
Jürgen


--
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)

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

Post a Comment