Set VIM to open files in "read-only" mode by default?

daveslab picture daveslab · Jul 30, 2010 · Viewed 14.2k times · Source

Straightforward question here and I can't make it any simpler than the title:

How do I set VIM to open files in "read-only" mode by default?

Thanks!

Answer

Peter picture Peter · Jul 30, 2010

add

set ro

to your .vimrc.

Also: commonly, you can type view filename instead of vim filename and it will open vim in readonly mode.