I'm using gvim 7.2 on Windows XP to edit files on a slow USB memory stick. When other programs are accessing the stick, the editor freezes for several seconds at a time.

I have already tried using the "set directory" command to move the Vim swap files to the hard disk. Why is gvim accessing the disk while I'm editing, and what can I do to prevent these freezes?

Update: Using process monitoring tools, I found that the freeze occurs when gvim checks whether file is changed when the window gains focus. Is there anyway to turn that off?


It could be gvim's autoread feature, which checks files being edited for changes made outside gvim. You can control this feature. See the relevant portion of the gvim FAQ.

  • Great suggestion! Sorry that's not it -- autoread is turned off by default and I have confirmed that it is off. – Steve Hanov Sep 4 '10 at 13:57

I would think this is due the the .filename.swp file vim reads and writes from in the same directory as the file you are editing.

To get around this, you can do:

:set dir=/tmp


This assumes that /tmp is fast (and not on the flash drive).

You could also do:

:set dir=/dev/shm


If your entire system is running out of flash, however, you will not get any recovery option after a system crash.

You could also put this in your .vimrc on a system booting/running from flash:

set dir=/dev/shm

  • This is still seen on vim 7.4, Windows 7 professional. Above things did not help :( – nac Aug 18 '15 at 7:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.