Fix errors that relate to reading or creating files in the temp or tmp environment on an MS Windows PC
From Vim Tips Wiki
Tip 1532 • Previous Tip • Next Tip
Created: November 13, 2007 Complexity: basic Author: corp-mule Version: 7.0
This tip will help resolve error messages E97, E483 and E485 encountered on machines running MS Windows. These errors relate to the creation of, or reading of temporary files. See :help E97, :help E483, :help E485. Also see Fix error E97 Cannot create diffs under Windows.
*e97* Can't create diffs blah blah *e485* Can't read file blah blah
I've experienced these errors when trying to use the diff commands, or any shell commands being called via the :! or :r! commands.
That is,
:r! sort blah blah blah % or :r! dir etc
To correct this problem you need to change your environment variable for $TMP or $TEMP. You can do this in a couple of different ways.
1. Use the Windows environment settings. Here is one method.
- Right click "My Computer".
- Choose "Properties".
- Click the "Advanced" tab.
- Click the "Environment Variables" button.
- In the bottom window pane, scroll down to the TMP or
TEMP variables and highlight them.
- Then click the "Edit" button and change the path to
the directory you want.
2. Use Vim – much better!
- Add the following to your _vimrc file:
let $TMP="c:/tmp"
In both cases, you need to create the directory (for example, C:\tmp), and you need read and write permission in that directory.
[edit] Comments
TO DO
- This tip needs reworking. A reader could get the impression that the only cause for the specified errors is due to TMP.
- Add a brief explanation of what the environment variables do.
- Probably want reference to :help dos-temp-files. Any others?
- The title is not helpful because a reader would only search for this title if they already knew the cause of their problem.
It's probably better for tips to be formatted reasonably consistently. I wouldn't advocate overdoing this, but I don't see why this tip uses <tt>...</tt> for the tip text, while the others don't.
It uses <tt>...</tt> cuz the defualt is too hard to read and, I like it. The diff ain't that big of a deal.
Categories: VimTip | Todo
