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.
tab sview /path/to/file
You can open a file in readonly mode from inside
or from command line:
$ vim -M /path/to/file
Just open your file by using
:tabe <filename>, then enter
:view. It will automatically switch to read-only mode.
vim -M filename open the file in readonly mode
:tabedit +set\ noma|set\ ro FILE; this will open
FILE in a new tab with
modifiable off and
readonly on, preventing you from modifying or writing the file. If you just want
readonly, omit the
noma set. Might be convenient to remap this to another command.