tags:

views:

60

answers:

2

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.

+1  A: 

Try :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.

Wyatt Anderson
You don't need the extra set: `:tabedit +set\ noma\ ro FILE`
Al
+3  A: 
tab sview /path/to/file
ZyX