Open a file in a tab in vim in readonly mode

Srikanth picture Srikanth · Oct 28, 2010 · Viewed 39.8k times · Source

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.

Answer

ZyX picture ZyX · Oct 28, 2010

To open a file in read only mode in a new tab, use

tab sview /path/to/file

To open the file in the same pane, (without using a new window or tab), use

view /path/to/file

Note that tab view /path/to/file does not open a new tab.