E138 Can T Write Viminfo File
When you run sudo vim you start vim as root. That means that it is the viminfo file in /root that is the problem.
You should do rm /root/.viminf*. To make sure of this, run sudo vim and execute this command::!echo $HOME. This will show you that your home directory is /root.
I would recommend that you do not run vim as root, but rather use sudoedit. This is a more secure solution as the editor is not running as root. You never know what a plugin might do. Additionally it allows you to use your own settings and plugins in vim and not the ones in roots vimrc. Sudoedit is the same as running sudo -e.
Sudoedit works by making a temporary copy of the file that is owned by the invoking user (you). When you finish editing, the changes are written to the actual file and the temporary file is deleted. As a general rule of thumb: Do not run things as root if it is not necessary.
Hope this helps you!
Jun 19, 2006 E138: Can't write viminfo file $HOME/. Maple Toolbox For Matlab V12 01 Tbe here. viminfo! Discussion in 'Mac' started by hotister@hotmail.com, Jun 19, 2006. E886: Can't rename viminfo file to /home/kjeld/.viminfo! Also on my old servers, root cannot write to /home/kjeld/.viminfo but they do not write an error message.