Vim under Windows 10 reports files as "read-only"

652 views
Skip to first unread message

Karthick Gururaj

unread,
Sep 18, 2017, 8:51:44 AM9/18/17
to vim_use
Hello folks,

I have Gvim 8.0 installed on a Windows 10 machine. Sometime in the
last few days, looks like there was an OS update that changed how
files in the 'Documents' folder are handled.

This is what I see now:
a. Editing files in, say C:\Windows\Temp\temp.txt works fine.
Similarly many other folders in C:\ work perfectly fine as well.
b. However, as far as I can see, ALL files in my 'Documents' are not
editable by gvim. The files open in readonly mode and trying to :w!
reports E212: Can't open file for writing.
c. Not sure if it matters, but the location of 'Documents' has been
moved from its OS default to D:\Karthick\Documents folder (this was
done a long time ago.. not a recent change)
d. Editing other files in D:\ also works correctly. It is only the
files in the D:\Karthick\Documents that report the error

The E212 error message is issued in all the following scenarios:
a. While trying to write any existing file in 'Documents'
b. While trying to create any new file in 'Documents'
c. Starting gvim in administrative mode also gives the same error
d. Starting gvim with '-u NONE' also gives the same error

I have used gvim on this system ever since 8.0 version came - and the
errors above are very recent (3 - 4 days). So naturally, the suspect
was that an OS update broke something.. For reference, the OS
installed the following:
1. KB4038788 - https://support.microsoft.com/en-in/help/4038788/windows-10-update-kb4038788
2. KB4038806 - https://support.microsoft.com/en-in/help/4038806/security-update-for-adobe-flash-player-sep-12-2017
3. KB4011069 - https://support.microsoft.com/en-us/help/4011069/descriptionofthesecurityupdateforpowerpoint2013september12-2017
4. KB4011103 - https://support.microsoft.com/en-us/help/20170912/security-update-deployment-information-september-12-2017
5. KB4011108 - https://support.microsoft.com/en-us/help/4011108/descriptionofthesecurityupdateforexcel2013september12-2017
6. KB4011090 - https://support.microsoft.com/en-us/help/4011090/descriptionofthesecurityupdateforoutlook2013september12-2017
7. KB3213564 - https://support.microsoft.com/en-us/help/3213564/descriptionofthesecurityupdateforoffice2013september12-2017
8. KB4011107 - https://support.microsoft.com/en-ie/help/4011107/description-of-the-security-update-for-skype-for-business-2015-lync-20

But the funny thing is, I'm able to edit the files in 'Documents' with
all other applications - like MS Word. The same text files that gvim
error'd out were editable by Notepad. I checked an image file with
gimp (as a non-MS application) - that worked normally as well with no
error reported by gimp (and trying to write the same image file via
gvim gave the E212 error).

I tried gvim reinstall after downloading the self-installer again - no
change in behavior.

Any clues/hints?

- Karthick

Ben Fritz

unread,
Sep 18, 2017, 12:38:32 PM9/18/17
to vim_use
On Monday, September 18, 2017 at 7:51:44 AM UTC-5, Karthick wrote:
> Hello folks,
>
> I have Gvim 8.0 installed on a Windows 10 machine. Sometime in the
> last few days, looks like there was an OS update that changed how
> files in the 'Documents' folder are handled.
>
> This is what I see now:
> a. Editing files in, say C:\Windows\Temp\temp.txt works fine.
> Similarly many other folders in C:\ work perfectly fine as well.
> b. However, as far as I can see, ALL files in my 'Documents' are not
> editable by gvim. The files open in readonly mode and trying to :w!
> reports E212: Can't open file for writing.

Perhaps it's because of the new-ish Windows 10 feature called "Controlled Folders", which prevents apps not on a whitelist from accessing your documents folder. This is intended as a ransomware protection feature. There's supposed to be a way to add apps to the whitelist, but Microsoft apps (and probably a few other common apps) are included by default.

Karthick Gururaj

unread,
Sep 19, 2017, 1:49:29 AM9/19/17
to vim_use
Thanks - that was the google keyword that I needed! In my case, it was
the antivirus Bitdefender that was blocking access to the files. Once
I add gvim to the white-list, the original issue gets resolved.
Reply all
Reply to author
Forward
0 new messages