René Nyffenegger
René Nyffenegger

Reputation: 40499

How and where is my viminfo option set?

As far as I can tell I don't set viminfo anywhere, yet it is set.

:verbose set viminfo?

prints

  viminfo='100,<50,s10,h,rA:,rB:
    Last set from ~/vimfiles/vimrc

But ~/vimfiles/vimrc doesn't set it.

Even if I let ~/vimfiles/vimrc set it to an arbitrary value, viminfo will still be set to '100,<50,s10,h,rA:,rB:.

Why is that and how can I set/unset viminfo?

Upvotes: 15

Views: 16627

Answers (4)

Marslo
Marslo

Reputation: 3251

You can set viminfo by temporary and permanent way:

  • For temporary way, you can input the setting command by :set viminfo=xxxx
  • For permanent way, you can input the setting in your ~/.vimrc in Linux and $VIM/_vimrc in Windows

My setting as below:

set viminfo=%,<800,'10,/50,:100,h,f0,n~/.vim/cache/.viminfo
"           | |    |   |   |    | |  + viminfo file path
"           | |    |   |   |    | + 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 (new name for ", vi6.2)
"           + save/restore buffer list

And, the most important is set viminfo=xxx should come after set nocompatible

Upvotes: 42

Jinguo Liu
Jinguo Liu

Reputation: 733

Warning: Better not setting these two variables: "<50,s10"

They are the maximum lines and maximum memory allowed, it will clear your clipboard without any warning if the number of lines exceeds!

Upvotes: -3

asdert
asdert

Reputation: 56

I had the same problem too. It turn out that the viminfo option is overwritten by the nocompatible flag. Since it overwrite other option too, it is better to place "set nocompatible" at very start of your vimrc file. This solved my issue with viminfo configuration.

Upvotes: 4

romainl
romainl

Reputation: 196546

That's the default value. :verbose is not really helpful, here, and that behaviour is not documented AFAIK but it always does that for default values.

I suggest you read :help 'viminfo' for the meaning of the values of the viminfo option and how to :set it (not :let).

Upvotes: 0

Related Questions