I don't know what causes it, but in Windows i use GVim (portable GVim), and need to open some file (that already exist, Vim didn't created it), but it opens it in readonly mode. i need to use w! to write it. I have proper permissions on windows directory, but, this seems like some flag in Vim as it says:

E45: 'readonly' option is set (add ! to override)

i don't want to type w! to save, because Vim is supposed to be portable (run from USB in windows), so it needs to work with foreign files it didn't created. When i create file in Vim, it doesn't complain.

How this work under Windows?

And i already have these flags, but not working:

set noro
set noreadonly
set write

1 Answer 1


set readonly is set automatically if the target file has READONLY flag set in file system. Make sure you don't accidentally create files with READONLY flag set.

  • i'm not sure how that goes in windows. i can open in all other editors, and edit it and save it fine. so it means i have permission to write, right? Feb 26, 2023 at 12:32
  • @IgorLerinc You can check all flags and permissions in file properties page by Windows explorer.
    – Matt
    Feb 26, 2023 at 12:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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