Monday, August 29, 2011

Re: storing variables in viminfo

Hi,

sinbad wrote:
> On Aug 29, 11:54 am, Jürgen Krämer <jottka...@googlemail.com> wrote:
>>
>> sinbad wrote:
>>
>>> how to explicitly store variables in to viminfo file.
>>> i want to store a global variable "g:var" into a
>>> viminfo file, i read the help it says global vars
>>> are stored by default but this doesn't seem to be
>>> happening. how to store it explicitly.i want the
>>> contents of the global variable to be restored
>>> after vim is restarted. how do i do that.
>>
>> from :help 'viminfo'
>>
>> | ! When included, save and restore global variables that start
>> ^^^^^^^^^^
>> | with an uppercase letter, and don't contain a lowercase
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> | letter. Thus "KEEPTHIS and "K_L_M" are stored, but "KeepThis"
>> ^^^^^^
>> | and "_K_L_M" are not. Nested List and Dict items may not be
>> | read back correctly, you end up with an empty item.
>>
>> 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)
>
> 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.

is g:MYLIST a list or a string?

Have you checked that the actual setting of 'viminfo' is correct with

set viminfo?

If you only have

set viminfo='20,"50,!

in your .vimrc it won't work, because the double quote is seen as the
start of a comment. You have to backslash-escape it:

set viminfo='20,\"50,!

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: