简体   繁体   English

我的viminfo选项设置的方式和位置是什么?

[英]How and where is my viminfo option set?

As far as I can tell I don't set viminfo anywhere, yet it is set. 据我所知,我没有在任何地方设置viminfo ,但它已经设置好了。

:verbose set viminfo?

prints 版画

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

But ~/vimfiles/vimrc doesn't set it. ~/vimfiles/vimrc没有设置它。

Even if I let ~/vimfiles/vimrc set it to an arbitrary value, viminfo will still be set to '100,<50,s10,h,rA:,rB: . 即使我让~/vimfiles/vimrc将其设置为任意值, viminfo仍将设置为'100,<50,s10,h,rA:,rB: .

Why is that and how can I set/unset viminfo ? 为什么这样,我如何设置/取消设置viminfo

You can set viminfo by temporary and permanent way: 您可以通过临时永久方式设置viminfo

  • For temporary way, you can input the setting command by :set viminfo=xxxx 对于临时方式,您可以通过:set viminfo=xxxx方式输入设置命令:set viminfo=xxxx
  • For permanent way, you can input the setting in your ~/.vimrc in Linux and $VIM/_vimrc in Windows 对于永久方式,您可以在Linux中的~/.vimrc和Windows中的$VIM/_vimrc中输入设置

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 (old name for <, vi6.2)
"           + save/restore buffer list

And, the most important is set viminfo=xxx should come after set nocompatible 并且, 最重要的是set viminfo=xxx应该在set nocompatible

I had the same problem too. 我也有同样的问题。 It turn out that the viminfo option is overwritten by the nocompatible flag. 事实证明,viminfo选项被nocompatible标志覆盖。 Since it overwrite other option too, it is better to place "set nocompatible" at very start of your vimrc file. 由于它也会覆盖其他选项,因此最好在vimrc文件的最开始处放置“set nocompatible”。 This solved my issue with viminfo configuration. 这解决了我的viminfo配置问题。

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. :verbose并不是真的很有帮助,而且这种行为没有记录在AFAIK中,但它始终为默认值执行此操作。

I suggest you read :help 'viminfo' for the meaning of the values of the viminfo option and how to :set it (not :let ). 我建议你阅读:help 'viminfo' ,了解viminfo选项值的含义以及如何:set它(不是:let )。

Please don't set these two variables: "<50,s10" if you don't fully understand what you are doing. 如果您不完全了解自己在做什么,请不要设置这两个变量:“<50,s10”。

They are the maximum lines and maximum memory allowed, you will have great change to miss your data in the future with either of these two arguments set, without any warning! 它们是允许的最大行数和最大内存量,您将有很大的改变,以便在将来设置这两个参数时错过您的数据,而不会发出任何警告!

Just leave them empty and default(no restrict). 只需将它们留空并默认(无限制)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM