Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to tell VIM to store the viminfo file somewhere else?

Tags:

Is it possible to tell vim to save its viminfo file somewhere else? Such as in the .vim folder

like image 798
Jimmy Lu Avatar asked Jun 09 '11 00:06

Jimmy Lu


People also ask

Is Viminfo the same as Vimrc?

They are not the same. The vimrc is the file you edit to change vim's behavior. It is a the configuration file. The viminfo is like a cache, to store cut buffers persistently, and other things.

How do I set up Viminfo?

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.

Where is .VIM directory?

Vim's user-specific configuration file is located in the home directory: ~/. vimrc , and Vim files of current user are located inside ~/. vim/ . The global configuration file is located at /etc/vimrc .


2 Answers

Try adding set viminfo+=n~/.vim/viminfo to your ~/.vimrc file. From :help 'viminfo':

    n       Name of the viminfo file.  The name must immediately follow             the 'n'.  Must be the last one!  If the "-i" argument was             given when starting Vim, that file name overrides the one             given here with 'viminfo'.  Environment variables are expanded             when opening the file, not when setting the option. 
like image 163
sarnold Avatar answered Oct 06 '22 13:10

sarnold


set viminfo='1000,nc:\\users\\abcdef\\_viminfo 

This works for me in Windows 7.

like image 41
Bharat Bhushan Avatar answered Oct 06 '22 13:10

Bharat Bhushan