Vi Editor – Fix viminfo Error E576

Ubuntuvi

I am proficient at using Unix/Linux, but I am not an expert. If I want to open a file (for example, file.txt), I use vi:

vi file.txt

This opens the file, and if I want to close it, I use :q!. I have been using this method for the two years that I have been using Unix/Linux. My institution has a cluster running Ubuntu Linux.

Today, however, I tried to open a file, and I got these error messages:

E576: viminfo: Missing '>' in line: newest to oldest):
E576: viminfo: Missing '>' in line: ?/CJ
E576: viminfo: Missing '>' in line: ?/CG
E576: viminfo: Missing '>' in line: ?/CC
E576: viminfo: Missing '>' in line: ?/OEP
E576: viminfo: Missing '>' in line: ?/CEP
E576: viminfo: Missing '>' in line: ?/dih
E576: viminfo: Missing '>' in line: ?/ang
E576: viminfo: Missing '>' in line: ??b
E576: viminfo: Missing '>' in line: ?/xvg
E136: viminfo: Too many errors, skipping rest of file
Press ENTER or type command to continue

So I press Enter. I get the same messages:

E576: viminfo: Missing '>' in line: newest to oldest):
E576: viminfo: Missing '>' in line: ?/CJ
E576: viminfo: Missing '>' in line: ?/CG
E576: viminfo: Missing '>' in line: ?/CC
E576: viminfo: Missing '>' in line: ?/OEP
E576: viminfo: Missing '>' in line: ?/CEP
E576: viminfo: Missing '>' in line: ?/dih
E576: viminfo: Missing '>' in line: ?/ang
E576: viminfo: Missing '>' in line: ??b
E576: viminfo: Missing '>' in line: ?/xvg
E136: viminfo: Too many errors, skipping rest of file
Press ENTER or type command to continue

Again I press Enter, and finally the file opens for reading/editing. However, the problem repeats when I try to close the file using :q!, and also when I try to open any other file using vi.

The key words CJ, CG, CC, OEP, CEP, dih, ang, and xvg (I am not sure about b, though) are all strings that often appear in files that I read using vi, although I am not certain that they all exist in the particular file that I am opening (I do not think so). Thus, perhaps something is wrong with my viminfo file? However, I am using vi, not vim.

I am not sure what has happened; do you have any suggestions of how I can diagnose, and possibly fix, this problem?

Best Answer

Do this:

rm -f ~/.viminfo

The .viminfo file keeps metadata about various useful, but non-critical state information. Yours is corrupt. Remove it.

Related Question