Thursday, February 16, 2012

Corrupted viminfo file: Illegal starting char


When you try to use vim, if this kind of message is the first thing you see:

E575: viminfo: Illegal starting char in line: b.ggly.vcrlx.30
E575: viminfo: Illegal starting char in line: ^I"^I107^I6
E575: viminfo: Illegal starting char in line: ^I.^I107^I6
E575: viminfo: Illegal starting char in line: ^I+^I43^I10

Basically "Illegal starting char in line: <some random stuff here>"
means that you (probably vim itself) has written to this file in such a way that it cannot read it any longer.

Viminfo is a file that stores some info about the vim session you have just had, like the search words, input line, command line history, position markers etc, so that when you restart the session, you can continue where you have left off.

So, once you realize, thanks to the error message above, that vim info is not read properly, you have two options:
1. delete the viminfo file altogether. If you don't care saving your history, markers etc, it is harmless. A new viminfo will be generated as soon as you have ended another vim session. The default place for this file is under $HOME/.viminfo , otherwise try under here: $VIM/.viminfo

2. open the file and see what went wrong. Especially if you get the above message, it is pretty clear that the starting character of the lines are not what viminfo expects it to be. In my case, it was pretty clear, I just needed to add ">" in the first line, and add the full address of the file b.ggly.vcrlx.30: 

> ~/b.ggly.vcrlx.30 

By doing so I indicated the address of the file correctly and all went fine.

Actually, you can even edit this file if you know what you are doing and generate a search history, input history etc beforehand. 


No comments:

Post a Comment