I wish to make Vim open every file in read-only mode.

My use case is that I use Vim as both my editor and a gdb frontend via the Pyclewn plugin. I typically have one instance of Vim open for editing and another for debugging. I wish that the debugging instance would always open source files in read-only mode so that I do not get the ".swp file already exists" prompt, or that I accidentally edit a file without meaning to.

1 Answer 1


There's a special command for this: view FILENAME


For other cool things, see the man page for vim(1): man 1 vim

  • Oh, right, of course. I just didn't think to start it as view instead of vim ;) .
    – Moshev
    Mar 11, 2016 at 18:15

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.