Tom Miller
Tom Miller

Reputation: 820

How do you make a file writable from vim in windows?

How do I make a file writable from Vim on a Windows machine? I currently manually go find the file in explorer, open it's properties and uncheck readonly. I would like to be able to do this more quickly.

Upvotes: 4

Views: 1951

Answers (3)

Xavier T.
Xavier T.

Reputation: 42238

It seems attrib is the Windows shell command to modify file attributes.

See :!attrib /?

:!attrib -R %should remove the Read only property on the file. (It is working here the [RO] flag is modified in my status bar).

You will be prompted to reload the file (if you don't have autoread set) : don't ! and then save with :w!

(Rereading your question I am not sure that the Read only flag is your issue there because :w! should work anyway. )

Upvotes: 8

Benoit
Benoit

Reputation: 79185

Use :saveas C:\Users\your_user_name\Desktop\temp.txt and use explorer to copy it to its original location with UAC.

Upvotes: 1

heijp06
heijp06

Reputation: 11798

Maybe I am missing something but :w! works for me.

Upvotes: 5

Related Questions