Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How and where is my viminfo option set?

Tags:

vim

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?

like image 790
René Nyffenegger Avatar asked Apr 11 '14 12:04

René Nyffenegger


People also ask

How to fix viminfo option is not working?

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. Show activity on this post.

How do I open a viminfo file?

If you type echo $HOME in command mode, Vim should display what value is set for HOME. Alternatively, you can try e $HOME\.viminfo and see if this opens the contents of the .viminfo file. If this is the case, you have found it!

How do I use the Vim setting options?

There are two ways to use the Vim setting options: 1. Enable the options for an individual file inside the Vim session using :set Open the desired file in Vim, type any option using the :set command in the Normal mode, and press Enter. 2.

Does ~/vimfiles/vimrc set viminfo?

:verbose set viminfo? 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:.


1 Answers

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

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

like image 123
Marslo Avatar answered Sep 25 '22 23:09

Marslo