According to this FAQ for moving .viminfo file to .vim dir we should add viminfo+=n~/.vim/viminfo to vimrc file but when I put this line in my vimrc, every time I open vim, it will return this: E492: Not an editor command: viminfo+=n~/.vim/viminfo But I don't know why and how can I fix it, so please let me know that and don't mark [duplicate] on this question.
Asked
Active
Viewed 4,241 times
3
Cy8099
- 433
- 6
- 15
2 Answers
4
viminfo is an option, @Tommy A forgot the keyword set in his command:
set viminfo+=n~/.vim/viminfo
should work properly. If you read :h 'viminfo' you can see an example:
:set viminfo='50,<1000,s100,:0,n~/vim/viminfo
Edit As @Carpetsmoker mentioned it in the comments, neovim has a different format for these options so one should use the following:
if has('nvim') | let &viminfo .= '.nvim' | endif
statox
- 49,782
- 19
- 148
- 225
1
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
tanish
- 11
- 1
if has('nvim') | let &viminfo .= '.nvim' | endif, as Neovim uses a different format. – Martin Tournoij Nov 29 '17 at 00:20