Wednesday, January 31, 2007

E138: Can't write viminfo file .viminfo!

It is almost 2 months, i was facing this error, with my Linux box. Couldn't really recognize the problem. Deleted the .viminfo file then deleted .viminfo! file as well, but all attempts in vain.

Some message if u see again and again, it is real frustrating.

Finally, today i decided to get rid of this message once and for all. As usual, searched on google.

Following was the solution::

*viminfo-errors*
When Vim detects an error while reading a viminfo file, it will not overwrite
that file. If there are more than 10 errors, Vim stops reading the viminfo
file. This was done to avoid accidentally destroying a file when the file
name of the viminfo file is wrong. This could happen when accidentally typing
"vim -i file" when you wanted "vim -R file" (yes, somebody accidentally did
that!). If you want to overwrite a viminfo file with an error in it, you will
either have to fix the error, or delete the file (while Vim is running, so
most of the information will be restored).


*:rv* *:rviminfo* *E195*
:rv[iminfo][!] [file] Read from viminfo file [file] (default: see above).
If [!] is given, then any information that is
already set (registers, marks, etc.) will be
overwritten. {not in Vi}


*:wv* *:wviminfo* *E137* *E138* *E574*
:wv[iminfo][!] [file] Write to viminfo file [file] (default: see above).
The information in the file is first read in to make
a merge between old and new info. When [!] is used,
the old information is not read first, only the
internal info is written. If 'viminfo' is empty, marks
for up to 100 files will be written.
When you get error "E138: Can't write viminfo file"
check that no old temp files were left behind (e.g.
~/.viminf*) and that you can write in the directory of
the .viminfo file.
{not in Vi}

22 comments:

Anonymous said...

Thanks! It worked for me.

ravindra goyal said...

thanks ... it was useful for me...
i was facing same prob since yesterday ... some how i got files .viminfa.tmp .viminfb.tmp like this 26 files .. i removed all those and things worked //

Anonymous said...

Hi Ravinda,
I'm new to Linux. Looking at my folder I have about 26 files (.viminf*.tmp, * is from a through z). How do you delete these files? When I use "rm" it tell me these files are system file and I can not delete them.
Thanks...

Anonymous said...

Good one. i was irritated by this simple error and once i delete the tmp file, it is back to normal :)

Anand said...

Thanks a ton..
I was also facing the same issue!!!

Namit said...

thnx dude
it helped me a lot

Sahil Garg said...

Thanx Buddy.......
It helped a lot..........

Unknown said...

Thanks this helped a lot. After removing the .viminfo.tmp file the problem was fixed.

Unknown said...

Thanks. Removing the .viminfo.tmp file worked like a dream for me.

Unknown said...

Thanks. Removing the .viminfo.tmp file worked like a dream.

Anonymous said...

Thanks for the solution. Iworked.

C.A.Gundapi said...

Great info .. It worked for me as well. Thanks a loooooooot.

Anonymous said...

Ooo yes worked like a dream :)

Anonymous said...

thank u; it helped :)

Anonymous said...

Thanks for the easy to follow advice, this helped me solve this problem too!

aravindous said...

Thanks that was helpful. It solved my problem.

Jon said...

Thank You, this worked like a charm. I had put up with this for 2 years, and finally got the time to investigate and fix.

AJ said...

Thank you!!

Unknown said...

I still had the error after removing the file. Turns out my disk quota was reached and I couldn't write any files at all. Deleted more stuff and it works again. Thanks.

Nanker Phelge said...

awesome! works for me

Anonymous said...

Thanks Lynn! My disk quota was reached too and deleting stuff worked for me.

Anonymous said...

For me launching screen this way helps:
screen -T xterm