set viminfo=:5000 vs set hi=500

classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

set viminfo=:5000 vs set hi=500

Oliver Fuchs
Hi,
I am using VIM - Vi IMproved 6.3 (2004 June 7, compiled Mar 17 2005 10:12:05) Included patches: 1-61 Compiled by [hidden email]

1)
I want to save my used commands with
        set hi=500
in my .vimrc which
works correctly.
Now I have read that I also can use the
        set viminfo='1000,<500,:500
to set the remembered commands up to 500.
But this does not work. It does not matter which value I take it
always stops later on after 20 remembered commands.

Here are my .vimrc entries for
a) working
        set hi=500
        set viminfo='50,<1000,s100
b) not working
        " set hi=500
        set viminfo='50,<1000,s100,:500

2)
Also I saw in the vim help that the history commands are remembered in
4 tables:
- one for ':' commands
- one for search strings
- one for expressions
- one for input lines, typed for the |input()| function.
But using the set viminfo only gives me the possibility to save three
of this tabels:
: Maximum number of items in the command-line history
/ Maximum number of items in the search pattern history
@ Maximum number of items in the input-line history
What about the table for the expressions?


Regards

Oliver
Reply | Threaded
Open this post in threaded view
|

Re: set viminfo=:5000 vs set hi=500

Christian Rother
Hi,
[...]

> set viminfo='1000,<500,:500
Wrong. This is
set viminfo=+:500,'1000,<500
correct notation.

> What about the table for the expressions?

nope

rgds
chris


       

       
               
___________________________________________________________
Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de
Reply | Threaded
Open this post in threaded view
|

Re: set viminfo=:5000 vs set hi=500

Oliver Fuchs
On Sat, 08 Oct 2005, Christian Rother wrote:

> Hi,
> [...]
>
> > set viminfo='1000,<500,:500
> Wrong. This is
> set viminfo=+:500,'1000,<500
> correct notation.
>

That gives me
Error detected while processing /home/oliverfuchs1/.vimrc:
while starting vim. I could not find anything about that in the help.

Oliver

--
... don't touch the bang bang fruit
Reply | Threaded
Open this post in threaded view
|

Re: set viminfo=:5000 vs set hi=500

A.J.Mechelynck
Oliver Fuchs wrote:

> On Sat, 08 Oct 2005, Christian Rother wrote:
>
>> Hi,
>> [...]
>>
>>> set viminfo='1000,<500,:500
>> Wrong. This is
>> set viminfo=+:500,'1000,<500
>> correct notation.
>>
>
> That gives me
> Error detected while processing /home/oliverfuchs1/.vimrc:
> while starting vim. I could not find anything about that in the help.
>
> Oliver
>

Christian was mistaken or maybe he was the victim of a typo.

You might want to try

        :set viminfo='1000,<500,:500,s64,h,r/tmp/,r/mnt/floppy/

Looking at the contents of my viminfo (with ":view ~/_viminfo", on Unix
it would by default be ":view ~/.viminfo") I see that the expression
history is saved but I still don't know according to what part (if any)
in 'viminfo'.


Best regards,
Tony.

Reply | Threaded
Open this post in threaded view
|

Re: set viminfo=:5000 vs set hi=500

Oliver Fuchs
On Sat, 08 Oct 2005, A. J. Mechelynck wrote:

> >> Wrong. This is
> >> set viminfo=+:500,'1000,<500
> >> correct notation.

[snip]

> > That gives me
> > Error detected while processing /home/oliverfuchs1/.vimrc:
> > while starting vim. I could not find anything about that in the help.
[snip]

> You might want to try
> :set viminfo='1000,<500,:500,s64,h,r/tmp/,r/mnt/floppy/

Hi,
I have now this in my .vimrc:
set viminfo='1000,<500,:25,s64,h,r/tmp/,r/mnt/floppy/
So there should be 25 commands remembered.
I test it:
a) open vim
b) type in vim :e /tmp/test1
c) repeat it up to 30 (e /tmp/testn with n=1-30)
Now this is what happens:
If I set in viminfo the ":" value < 20 (e.g. set viminfo=:5) only this
much commands will be later on remembered.
If I put the value > 20 (e.g. set viminfo=:25) only 20 commands (the
default value) are remembered.
With the viminfo setting in my .vimrc I am not able to set the value
bigger than the default value (20).
MAybe I am missing something?

Here is my complete .vimrc:

set ai nocp digraph ek hid   ru sc wmnu   noeb noet nosol
set bs=2 fo=cqrt ls=2 shm=at tw=72 ww=<,>,h,l
set comments=b:#,:%,n:>
set list listchars=tab:?*,trail:*
" : Maximum number of items in the command-line history to be
" saved. When not included, the value of 'history' is used.
" So enable
" a) set hi=500 or
" b) set viminfo='1000,f1,<500,;500
set viminfo='1000,<500,:25,s64,h,r/tmp/,r/mnt/floppy/
set number
set autoindent
set vb t_vb=
nnoremap Q <c-]>
" Replace of CTRL-] that is not
" working on OpenBSD see h CTRL-]
syntax enable
runtime ftplugin/man.vim
runtime ftplugin/mail.vim
"   Edit another file in the same directory as the current file
"   uses expression to extract path from current file's path
"  (thanks Douglas Potts)
if has("unix")
    map ,e :e <C-R>=expand("%:p:h") . "/" <CR>
else
    map ,e :e <C-R>=expand("%:p:h") . "\\" <CR>
endif
map <C-X> :!mutt<enter><enter>
map <C-T> :w!<CR>:!aspell check %<CR>:e! %<CR>
map <C-Z> :w!<CR>:!aspell --lang=de check %<CR>:e! %<CR>

Best regards
Oliver
--
... don't touch the bang bang fruit
Reply | Threaded
Open this post in threaded view
|

Re: set viminfo=:5000 vs set hi=500

Chris Allen
On 09/10/05, Oliver Fuchs <[hidden email]> wrote:
> If I set in viminfo the ":" value < 20 (e.g. set viminfo=:5) only this
> much commands will be later on remembered.
> If I put the value > 20 (e.g. set viminfo=:25) only 20 commands (the
> default value) are remembered.

I suspect you are running afoul of the 'history' option, which
defaults to twenty.  This setting controls the maximum number of
history commands stored in memory.

HTH,
Chris Allen
Reply | Threaded
Open this post in threaded view
|

Re: set viminfo=:5000 vs set hi=500

Oliver Fuchs
On Sun, 09 Oct 2005, Chris Allen wrote:

> On 09/10/05, Oliver Fuchs <[hidden email]> wrote:
> > If I set in viminfo the ":" value < 20 (e.g. set viminfo=:5) only this
> > much commands will be later on remembered.
> > If I put the value > 20 (e.g. set viminfo=:25) only 20 commands (the
> > default value) are remembered.
>
> I suspect you are running afoul of the 'history' option, which
> defaults to twenty.  This setting controls the maximum number of
> history commands stored in memory.

Hi,
I tried the same test with only one entry in my .vimrc:
set viminfo='1000,<500,:25,s64,h,r/tmp/,r/mnt/floppy/
I am not able to get vim to remember more than 20 commands.
I always thought that the viminfo entry overrides the history-default.
So I only can change the default behaviour of this with
        set hi=25
and not with the viminfo settings?

Oliver

>
> HTH,
> Chris Allen

--
... don't touch the bang bang fruit
Reply | Threaded
Open this post in threaded view
|

Re: set viminfo=:5000 vs set hi=500

Chris Allen
On 09/10/05, Oliver Fuchs <[hidden email]> wrote:
> Hi,
> I tried the same test with only one entry in my .vimrc:
> set viminfo='1000,<500,:25,s64,h,r/tmp/,r/mnt/floppy/
> I am not able to get vim to remember more than 20 commands.
> I always thought that the viminfo entry overrides the history-default.

I see nothing to that effect in the help text for either option.  The
viminfo option does say that if : does not appear then the value from
'history' will be used as a default.  It would be *nice* if  a higher
setting in viminfo over-rode a low setting in 'history', but I see
nothing to indicate that that is the case currently.  It would also
explain your observations.

> So I only can change the default behaviour of this with
>         set hi=25
> and not with the viminfo settings?

I believe you will find you need *both*.  Viminfo controls how much is
written to disk, but 'history' controls how much is saved in memory.

HTH,
Chris Allen
Reply | Threaded
Open this post in threaded view
|

Re: set viminfo=:5000 vs set hi=500

Oliver Fuchs
On Sun, 09 Oct 2005, Chris Allen wrote:

> On 09/10/05, Oliver Fuchs <[hidden email]> wrote:
> > Hi,
> > I tried the same test with only one entry in my .vimrc:
> > set viminfo='1000,<500,:25,s64,h,r/tmp/,r/mnt/floppy/
> > I am not able to get vim to remember more than 20 commands.
> > I always thought that the viminfo entry overrides the history-default.
>
> I see nothing to that effect in the help text for either option.  The
> viminfo option does say that if : does not appear then the value from
> 'history' will be used as a default.  It would be *nice* if  a higher
> setting in viminfo over-rode a low setting in 'history', but I see
> nothing to indicate that that is the case currently.  It would also
> explain your observations.

Yes - I agree. It seems that you only can downsize the 20-default (or
whatever is set with set hi =) but not upsize it.

>
> > So I only can change the default behaviour of this with
> >         set hi=25
> > and not with the viminfo settings?
>
> I believe you will find you need *both*.  Viminfo controls how much is
> written to disk, but 'history' controls how much is saved in memory.

Yes, surely I will use set hi.
So thanks for helping and taking time to answer.

Oliver

>
> HTH,
> Chris Allen

--
... don't touch the bang bang fruit
Reply | Threaded
Open this post in threaded view
|

Re: set viminfo=:5000 vs set hi=500

Matthew Winn
In reply to this post by Chris Allen
On Sun, Oct 09, 2005 at 05:20:04PM +0100, Chris Allen wrote:

> On 09/10/05, Oliver Fuchs <[hidden email]> wrote:
> > I tried the same test with only one entry in my .vimrc:
> > set viminfo='1000,<500,:25,s64,h,r/tmp/,r/mnt/floppy/
> > I am not able to get vim to remember more than 20 commands.
> > I always thought that the viminfo entry overrides the history-default.
>
> I see nothing to that effect in the help text for either option.  The
> viminfo option does say that if : does not appear then the value from
> 'history' will be used as a default.  It would be *nice* if  a higher
> setting in viminfo over-rode a low setting in 'history', but I see
> nothing to indicate that that is the case currently.

Not all that nice.  The way things stand at the moment you can set
viminfo to some suitably high limit and then know that whatever value
you use for history that many values will be saved, with the viminfo
value ensuring that you don't save a really stupid number.  Then you
can vary the value of history as you see fit, so if you've made a
really dumb mistake and need to conceal it by wiping out your history
you can do so simply by setting history low.  Having to change _two_
values each time you want to trim your command history would be a pain.
The way it works at the moment you can set viminfo once and then forget
all about it.

--
Matthew Winn ([hidden email])
Reply | Threaded
Open this post in threaded view
|

Re: set viminfo=:5000 vs set hi=500

A.J.Mechelynck
Matthew Winn wrote:

> On Sun, Oct 09, 2005 at 05:20:04PM +0100, Chris Allen wrote:
>> On 09/10/05, Oliver Fuchs <[hidden email]> wrote:
>>> I tried the same test with only one entry in my .vimrc:
>>> set viminfo='1000,<500,:25,s64,h,r/tmp/,r/mnt/floppy/
>>> I am not able to get vim to remember more than 20 commands.
>>> I always thought that the viminfo entry overrides the history-default.
>> I see nothing to that effect in the help text for either option.  The
>> viminfo option does say that if : does not appear then the value from
>> 'history' will be used as a default.  It would be *nice* if  a higher
>> setting in viminfo over-rode a low setting in 'history', but I see
>> nothing to indicate that that is the case currently.
>
> Not all that nice.  The way things stand at the moment you can set
> viminfo to some suitably high limit and then know that whatever value
> you use for history that many values will be saved, with the viminfo
> value ensuring that you don't save a really stupid number.  Then you
> can vary the value of history as you see fit, so if you've made a
> really dumb mistake and need to conceal it by wiping out your history
> you can do so simply by setting history low.  Having to change _two_
> values each time you want to trim your command history would be a pain.
> The way it works at the moment you can set viminfo once and then forget
> all about it.
>

It's simpler than that, actually. The 'history' setting defines how many
lines are remembered while Vim is running. Once that level is reached,
each additional "new" ex-command (or search command or...) "pushes" the
oldest one away, forgets it, moves it into limbo. When Vim exits, its
saves the history to disk (in the viminfo). Of course, commands already
forgotten cannot be saved anymore.

The 'viminfo' settings override the 'history' setting only in the sense
that the 'viminfo' settings are maximum numbers of values to be saved:
if there are more than that in memory, the excess is lost when exiting
Vim. Under ":help 'viminfo'" I the description of most sub-options
begins with the words "Maximum number of".


Best regards,
Tony.

Reply | Threaded
Open this post in threaded view
|

Re: set viminfo=:5000 vs set hi=500

Oliver Fuchs
On Mon, 10 Oct 2005, A. J. Mechelynck wrote:

> Matthew Winn wrote:
> > On Sun, Oct 09, 2005 at 05:20:04PM +0100, Chris Allen wrote:
> >> On 09/10/05, Oliver Fuchs <[hidden email]> wrote:
> >>> I tried the same test with only one entry in my .vimrc:
> >>> set viminfo='1000,<500,:25,s64,h,r/tmp/,r/mnt/floppy/
> >>> I am not able to get vim to remember more than 20 commands.
> >>> I always thought that the viminfo entry overrides the history-default.
> >> I see nothing to that effect in the help text for either option.  The
> >> viminfo option does say that if : does not appear then the value from
> >> 'history' will be used as a default.  It would be *nice* if  a higher
> >> setting in viminfo over-rode a low setting in 'history', but I see
> >> nothing to indicate that that is the case currently.
> >
> > Not all that nice.  The way things stand at the moment you can set
> > viminfo to some suitably high limit and then know that whatever value
> > you use for history that many values will be saved, with the viminfo
> > value ensuring that you don't save a really stupid number.  Then you
> > can vary the value of history as you see fit, so if you've made a
> > really dumb mistake and need to conceal it by wiping out your history
> > you can do so simply by setting history low.  Having to change _two_
> > values each time you want to trim your command history would be a pain.
> > The way it works at the moment you can set viminfo once and then forget
> > all about it.
> >
>
> It's simpler than that, actually. The 'history' setting defines how many
> lines are remembered while Vim is running. Once that level is reached,
> each additional "new" ex-command (or search command or...) "pushes" the
> oldest one away, forgets it, moves it into limbo. When Vim exits, its
> saves the history to disk (in the viminfo). Of course, commands already
> forgotten cannot be saved anymore.
>
> The 'viminfo' settings override the 'history' setting only in the sense
> that the 'viminfo' settings are maximum numbers of values to be saved:
> if there are more than that in memory, the excess is lost when exiting
> Vim. Under ":help 'viminfo'" I the description of most sub-options
> begins with the words "Maximum number of".
>
>
> Best regards,
> Tony.

Thanks again for so much help and time you did spend on this item.

By the way ... is there a possibility that special entries in the
vimino file are not allowed to be deleted or overwritten.
E.G. I store with vimonfo one special command that I do not want to be
overwritten in the viminfo file - is there a possibility? Maybe with a
leading # to the line that may not be deleted?


Oliver
--
... don't touch the bang bang fruit
Reply | Threaded
Open this post in threaded view
|

RE: set viminfo=:5000 vs set hi=500

Keith W. Roberts
In reply to this post by Oliver Fuchs
----Original Message----
From: Oliver Fuchs [mailto:[hidden email]]
Sent: Monday, October 10, 2005 11:48 AM
To: vim org
Subject: Re: set viminfo=:5000 vs set hi=500

>
> Thanks again for so much help and time you did spend on this item.
>
> By the way ... is there a possibility that special entries in the
> vimino file are not allowed to be deleted or overwritten.
> E.G. I store with vimonfo one special command that I do not want to be
> overwritten in the viminfo file - is there a possibility? Maybe with a
> leading # to the line that may not be deleted?
>
>
> Oliver

This actually sounds like a great idea.  Maybe something akin to a
modeline:

" viminfo: any command at all here

I don't think this would be confused with data, but instead of the
syntax
        [text] {white} viminfo:[white]command
I would use
        "[text] {white} viminfo:[white]command

If it's forced to be a comment it can't be confused with anything else,
and it could be merged into the new viminfo at the end of whatever
"section" it was found in (or at the beginning, if it immediately
followed the section identifier).

-Keith
Reply | Threaded
Open this post in threaded view
|

Re: set viminfo=:5000 vs set hi=500

A.J.Mechelynck
In reply to this post by Oliver Fuchs
Oliver Fuchs wrote:

> Thanks again for so much help and time you did spend on this item.
>
> By the way ... is there a possibility that special entries in the
> vimino file are not allowed to be deleted or overwritten.
> E.G. I store with vimonfo one special command that I do not want to be
> overwritten in the viminfo file - is there a possibility? Maybe with a
> leading # to the line that may not be deleted?
>
>
> Oliver

If you don't use it, it will sooner or later be "pushed out" of history;
but you can remember it in your vimrc by means of a mapping, an
abbreviation, or a user-command; or in your viminfo by saving it to a
register.

Examples (shown as they would be in the vimrc, i.e., without initial colon):

To always open the help window at the bottom:

cabbrev h bot h

To repeat a search-and-replace over the whole file by hitting a single
key (between colon and Return)

cabbrev ? %&&

To change all HTML/XHTML/XML tags' case (untested) (all on one line)
(treats any word immediately preceded by < or </ as a tag; doesn't act
on tag attributes)

command -nargs=0 -range TagsToLower <line1>,<line2>s/</\?\w*\>/\L\0\E/g
command -nargs=0 -range TagsToUpper <line1>,<line2>s/</\?\w*\>/\U\0\E/g

To toggle keymaps on and off (also for normal-mode commands like r)
using F8:

map <F8> :let &imi = ! &imi<CR>
map! <F8> <C-^>


See
        :help :map
        :help :map-overview
        :help abbreviations
        :help :cabbrev
        :help :command
        :help q

Best regards,
Tony.

Reply | Threaded
Open this post in threaded view
|

RE: set viminfo=:5000 vs set hi=500

Keith W. Roberts
In reply to this post by Oliver Fuchs
----Original Message----
From: A. J. Mechelynck [mailto:[hidden email]]
Sent: Monday, October 10, 2005 4:18 PM
To: vim org
Subject: Re: set viminfo=:5000 vs set hi=500

> Oliver Fuchs wrote:
>> Thanks again for so much help and time you did spend on this item.
>>
>> By the way ... is there a possibility that special entries in the
>> vimino file are not allowed to be deleted or overwritten.
>> E.G. I store with vimonfo one special command that I do not want to
>> be overwritten in the viminfo file - is there a possibility? Maybe
>> with a leading # to the line that may not be deleted?
>>
>>
>> Oliver
>
> If you don't use it, it will sooner or later be "pushed out"
> of history;
> but you can remember it in your vimrc by means of a mapping, an
> abbreviation, or a user-command; or in your viminfo by saving it to a
> register.
>
> Examples (shown as they would be in the vimrc, i.e., without
> initial colon):
>
> To always open the help window at the bottom:
>
> cabbrev h bot h
>
> To repeat a search-and-replace over the whole file by hitting a single
> key (between colon and Return)
>
> cabbrev ยต %&&
>
> To change all HTML/XHTML/XML tags' case (untested) (all on one line)
> (treats any word immediately preceded by < or </ as a tag; doesn't
> act on tag attributes)
>
> command -nargs=0 -range TagsToLower
> <line1>,<line2>s/</\?\w*\>/\L\0\E/g
> command -nargs=0 -range TagsToUpper
> <line1>,<line2>s/</\?\w*\>/\U\0\E/g
>
> To toggle keymaps on and off (also for normal-mode commands like r)
> using F8:
>
> map <F8> :let &imi = ! &imi<CR>
> map! <F8> <C-^>
>
>
> See
> :help :map
> :help :map-overview
> :help abbreviations
> :help :cabbrev
> :help :command
> :help q
>
> Best regards,
> Tony.

I don't think that's what the OP is talking about.  I happen to think this would be a useful feature, for example, in the case where you *want* to store *most* global variables, but one or two need to be overridden (eg, to reinitialize an ftplugin, let's say, where you may have departed from the default settings but want to always start up in the default manner).

I know, that's very specific, but there are a number of situations that I'd like to "start fresh" after restoring a prior session, along with its associated viminfo.

-Keith
Reply | Threaded
Open this post in threaded view
|

Re: set viminfo=:5000 vs set hi=500

Oliver Fuchs
In reply to this post by A.J.Mechelynck
On Tue, 11 Oct 2005, A. J. Mechelynck wrote:

> Oliver Fuchs wrote:
> > Thanks again for so much help and time you did spend on this item.
> >
> > By the way ... is there a possibility that special entries in the
> > vimino file are not allowed to be deleted or overwritten.
> > E.G. I store with vimonfo one special command that I do not want to be
> > overwritten in the viminfo file - is there a possibility? Maybe with a
> > leading # to the line that may not be deleted?
> >
> >
> > Oliver
>
> If you don't use it, it will sooner or later be "pushed out" of history;
> but you can remember it in your vimrc by means of a mapping, an
> abbreviation, or a user-command; or in your viminfo by saving it to a
> register.
>
> Examples (shown as they would be in the vimrc, i.e., without initial colon):
>
> To always open the help window at the bottom:
>
> cabbrev h bot h
>
> To repeat a search-and-replace over the whole file by hitting a single
> key (between colon and Return)
>
> cabbrev ? %&&
>
> To change all HTML/XHTML/XML tags' case (untested) (all on one line)
> (treats any word immediately preceded by < or </ as a tag; doesn't act
> on tag attributes)
>
> command -nargs=0 -range TagsToLower <line1>,<line2>s/</\?\w*\>/\L\0\E/g
> command -nargs=0 -range TagsToUpper <line1>,<line2>s/</\?\w*\>/\U\0\E/g
>
> To toggle keymaps on and off (also for normal-mode commands like r)
> using F8:
>
> map <F8> :let &imi = ! &imi<CR>
> map! <F8> <C-^>
>
>
> See
> :help :map
> :help :map-overview
> :help abbreviations
> :help :cabbrev
> :help :command
> :help q
>
> Best regards,
> Tony.

Thanks again for the big input - I will try one of the suggested ways
to store/remember a command.

Oliver
--
... don't touch the bang bang fruit