Macos – Vim complains about a temporary file when opening syntax highlighted files on Mac OS X

macosvim

When I try to open a file (e.g. test/test_sequence.rb) using Vim or MacVim I get the following error:

"test/test_sequence.rb" 109L, 3697C
Vim(let):E484: Can't open file /var/folders/zO/zOCN9kiiGD4keWX3TWYEh++++TI/-Tmp-/vzTkbXD/0

This seems only restricted to files which have some kind of syntax highlighting. I can still edit the file but I have to use :w! to write the changes the first time. I'm using vim on Mac OS X. I tried a lot of googling for this error with no luck and this has become really frustrating. Could anyone offer a fix for this?

EDIT: I don't get this error when editing syntax highlighted LaTeX files but do with syntax highlighted Ruby files.

Best Answer

Turns out the problem was with the shell. Vim was trying to use /bin/screen as the shell

set shell /bin/sh

In my vimrc fixed the problem.

Related Question