2

Apologies if this is duplicate. I have searched and haven't found any related questions.

What is the difference between the options readonly and nowrite? The reference manual says:

  • readonly: If on, writes fail unless you use a '!'. Protects you from accidentally overwriting a file.
  • write: Allows writing files. When not set, writing a file is not allowed.

From these definitions, readonly and nowrite seem synonymous to me.

Thanks in advance!

4

The primary difference is that readonly is per-buffer and write is global to vim.

  • readonly is generally used when editing specific files that you do not have access to write (like /etc/fstab). Any buffer can be set to readonly if you want to prevent accidentally writing it to file.

  • nowrite can be used to put vim into view-only mode, like pager utilities more or less, except temporary edits to the buffer are still allowed.

1
  • 1
    This makes sense. Thanks a lot! – mgarort Feb 16 at 3:48

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.