set viminfo='100,:200,<50,s10,h won't change the number of commandlines saved

987 views
Skip to first unread message

Lily

unread,
Oct 10, 2009, 1:40:56 PM10/10/09
to vim_use
I use
set viminfo='100,:200,<50,s10,h
in my .vimrc to try to make vim remember more lines of commands, but
it doesn't work, and
set viminfo
returns '100,:200,<50,s10,h. Anyone knows why?

Thanks.

Jürgen Krämer

unread,
Oct 11, 2009, 5:37:53 AM10/11/09
to vim...@googlegroups.com

Hi,

I'm not sure, but you might have to

:set history=200

as well.

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)

Brett Stahlman

unread,
Oct 11, 2009, 10:43:10 AM10/11/09
to vim_use


On Oct 11, 4:37 am, Jürgen Krämer <j...@jottkaerr.de> wrote:
> Hi,
>
> Lily wrote:
>
> > I use
> >     set viminfo='100,:200,<50,s10,h
> > in my .vimrc to try to make vim remember more lines of commands, but
> > it doesn't work, and
> >     set viminfo
> > returns '100,:200,<50,s10,h. Anyone knows why?
>
> I'm not sure, but you might have to
>
>   :set history=200
>
> as well.

Yes. The 'viminfo' `:' flag determines how many commands are *saved*
to the viminfo file; the 'history' option determines how many are
*restored* upon startup. There's a bit of asymmetry here, since
'viminfo' defaults to 'history', but not the other way around. The
bottom line, as Jürgen indicates, is that you should set 'history' to
match 'viminfo' if you want to restore all the commands you save.

Brett Stahlman

Bee

unread,
Oct 11, 2009, 11:08:21 PM10/11/09
to vim...@googlegroups.com

On Oct 11, 2009, at 6:56 PM, Brett Stahlman wrote:
> Yes. The 'viminfo' `:' flag determines how many commands are *saved*
> to the viminfo file; the 'history' option determines how many are
> *restored* upon startup. There's a bit of asymmetry here, since
> 'viminfo' defaults to 'history', but not the other way around. The
> bottom line, as Jürgen indicates, is that you should set 'history' to
> match 'viminfo' if you want to restore all the commands you save.

I am using:
set history=111 "command-line history restored
set viminfo=%,\"4,'4,/111,:111,h,f0
" | | | | | | +file marks 0-9,A-Z 0=NOT stored
" | | | | | +disable 'hlsearch' loading viminfo
" | | | | +command-line history saved
" | | | +search history saved
" | | +files marks saved
" | +lines saved each register (old name for <, vi6.2)
" +save/restore buffer list

I would like to use the value in 'history' to set the values in
'viminfo':
But this does not work:

set viminfo=%,\"4,'4,/history,:history,h,f0

--
Bill
Santa Cruz, California

Stahlman Family

unread,
Oct 11, 2009, 11:26:55 PM10/11/09
to vim...@googlegroups.com

Try this:
let &viminfo = '%,"4,''4,/' . &history . ',:' . &history . ',h,f0'

:help let-option

Brett Stahlman

>

Bee

unread,
Oct 12, 2009, 12:20:58 AM10/12/09
to vim_use
On Oct 11, 2009, at 8:26 PM, Brett Stahlman wrote:
> Try this:
> let &viminfo = '%,"4,''4,/' . &history . ',:' . &history . ',h,f0'

Thank you, I now understand.
I made changes and it works.
(Best read with monospaced font)

set history=111 "command-line history restored
let &viminfo='%,h,"4,''4,f0,/99,:' . &history
" | | | | | | +command-line history saved
" | | | | | +search history saved
" | | | | +marks 0-9,A-Z 0=NOT saved
" | | | +files saved for marks
" | | +lines saved each register (old name for <, vi6.2)
" | +disable 'hlsearch' loading viminfo
" +save/restore buffer list

Lily

unread,
Oct 12, 2009, 1:17:45 AM10/12/09
to vim_use
> I'm not sure, but you might have to
> :set history=200
> as well.
> Jürgen Krämer

> Yes. The 'viminfo' `:' flag determines how many commands are *saved*
> to the viminfo file; the 'history' option determines how many are
> *restored* upon startup. There's a bit of asymmetry here, since
> 'viminfo' defaults to 'history', but not the other way around. The
> bottom line, as Jürgen indicates, is that you should set 'history' to
> match 'viminfo' if you want to restore all the commands you save.
>
> Brett Stahlman

Thank all of you, I understand and the problem has solved now.
It needs to set 'history' as the same time. But I still don't
understand why
things become like this. I've look into the .viminfo file, and
discovered
that only 'history' lines of commands have been saved, not the one set
in
'viminfo'. It is not so easy to understand for me.

Jürgen Krämer

unread,
Oct 12, 2009, 1:28:32 AM10/12/09
to vim...@googlegroups.com

Hi,

Lily schrieb:

the value of 'history' not only determines how many entries are read
from the viminfo file on startup, but it also restricts the number of
entries that are remembered during a Vim session. Thus even if the
'viminfo' option includes large values for the different history lists,
Vim cannot save more entries than those that are kept in memory.

Lily

unread,
Oct 12, 2009, 2:41:44 AM10/12/09
to vim_use
Oh I see. Thank you.

Bee

unread,
Oct 12, 2009, 8:08:59 PM10/12/09
to vim_use
> On Oct 11, 2009, at 8:26 PM, Brett Stahlman wrote:
> > Try this:
> > let &viminfo = '%,"4,''4,/' . &history . ',:' . &history . ',h,f0'
>
> Thank you, I now understand.
> I made changes and it works.
> ...
> set history=111 "command-line history restored
> let &viminfo='%,h,"4,''4,f0,/99,:' . &history

That worked MacOS 10.4.11 with vim version 7.2.264,
but fails with the system built-in vim version 6.2.
It seems vim version 6.2 does not understand ''4

I changed it to the following and
it now works with vim version 6.2

set history=111
let &viminfo="%,h,\"4,'4,f0,/99,:" . &history

Tony Mechelynck

unread,
Nov 8, 2009, 4:35:07 AM11/8/09
to vim...@googlegroups.com, Brett Stahlman
On 11/10/09 16:43, Brett Stahlman wrote:
>
>
>
> On Oct 11, 4:37 am, Jürgen Krämer<j...@jottkaerr.de> wrote:
>> Hi,
>>
>> Lily wrote:
>>
>>> I use
>>> set viminfo='100,:200,<50,s10,h
>>> in my .vimrc to try to make vim remember more lines of commands, but
>>> it doesn't work, and
>>> set viminfo
>>> returns '100,:200,<50,s10,h. Anyone knows why?
>>
>> I'm not sure, but you might have to
>>
>> :set history=200
>>
>> as well.
>
> Yes. The 'viminfo' `:' flag determines how many commands are *saved*
> to the viminfo file; the 'history' option determines how many are
> *restored* upon startup. There's a bit of asymmetry here, since
> 'viminfo' defaults to 'history', but not the other way around. The
> bottom line, as Jürgen indicates, is that you should set 'history' to
> match 'viminfo' if you want to restore all the commands you save.
>
> Brett Stahlman

Actually, what 'history' determines is the maximum number of history
items that Vim keeps in memory while running. When recording the viminfo
(at closedown or in response to the :wvi command) there's of course no
way Vim can record entries which it has already forgotten (because they
exceeded the maximum number kept in memory).


Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
183. You move your coffeemaker next to your computer.

Tony Mechelynck

unread,
Nov 11, 2009, 3:48:33 PM11/11/09
to vim...@googlegroups.com, Bee
Just omit the / and : subparts, and they will use the value of 'history'
(which is their default, and also their maximum effective value since
that's how many entries Vim remembers).

Best regards,
Tony.
--
Expect the worst, it's the least you can do.
Reply all
Reply to author
Forward
0 new messages