Open a file in a tab in vim in readonly mode

Viewed 44577

I'm aware of opening files in readonly mode from shell using vim -R, but how to open a file from inside vim in a separate tab (:tabe <filename>) in readonly mode?

Thanks for your time.

7 Answers
vim -R /path/to/file
vim -m /path/to/file

Read-only mode. Modification in text is allowed but you cannot write (no saving).

vim -M /path/to/file

Even modification in text is not allowed.

Something that works for me:

:vnew path/to/file

and once the file is opened, give the view command:

:view
Related