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.
Just use vi's exclamation mark suffix to the write command (:w!) to force overwriting your own READONLY file.
There are many modes for opening a file: r - open a file in read mode. w - opens or create a text file in write mode.
Starting the vi Editor. vi filename: Creates a new file if it already not exist, otherwise opens existing file. vi -R filename : Opens an existing file in read only mode. view filename : Opens an existing file in read only mode.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With