5

I use gvim 7.2 script dev and other admin work on a Windows XP laptop and it has picked my network share as the location of the _viminfo. This is problematic because it takes a long time for vim to start. Is there a way to change the location of _viminfo file with out modifying my environment.

4 Answers 4

6

Use the viminfo option to set the location of your _viminfo. eg

:set viminfo=nC:\\_viminfo

More information is available from Vim's online help ...

:help viminfo
3
  • That sort of worked. I had to add the value for the ' char, not sure why but it worked.
    – bkoch
    Jun 30, 2009 at 13:43
  • Yeah, not quite. Edit "C:\Program Files (x86)\Vim_vimrc" and add "set viminfo+=nc:\_viminfo". That seems to have worked.
    – Bye
    Feb 24, 2011 at 4:31
  • 1
    It seems that the + adds on to the default value and (as the above commenter mentioned) you need the ' value so I am guessing it is required (probably mentioned in the docs somewhere). So this also worked "set viminfo='100,nc:\_viminfo"
    – Bye
    Feb 24, 2011 at 4:39
2

The $HOME on your login mapped to the network drive is probably causing this.

The easiest way to override this it with an alias that makes vim pick a specific viminfo file.

vim -i _viminfo

However, if you choose C:\ as the path for your viminfo file on a shared machine, the next person trying the same trick may pickup your viminfo file. So, it might be prudent to use,

vim -i _vim-yourname

Finally, to get this working on your machine, you can make a shortcut to vim that has the -i setting defined in it.

0

if you are on windows, simplest thing to do is use setlocal, endlocal and set your home drive to something else in between.

for example, edit your C:\Windows\vim.bat

at top, add line

setlocal
REM then set your home drive to something local like C: or D
set HOMEDRIVE=D:

REM at bottom final line should be:
endlocal
0

I know its quite a while now, but I am just mentioning this for future readers.

I was facing the same issue while trying to change the location for viminfo file in vimrc. At last setting the value of viminfofile option worked for me.

Added the following to my vimrc:

set viminfofile=D:\vim\viminfo

It works for me on windows with vim 8.2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .