VIM open a file in vertical mode in read-only mode

In vim, I can open the file in vertical split with the vs myfile.txt command, and I can open the file in a new editor in read-only mode with vim -R myfile.txt .

I want to combine them with teams, ideally vs -R myfile.txt, but of course I already found that this does not work. I want to open the file this way, because I have the file open on a different tab, and I want to be sure that I did not accidentally edit the file.

+8
vim
source share
2 answers

The command to view the file in readonly mode is :view . You can split the current window and run :view :

 :vs|view file 

And here is the option:

 :vert sview 
+11
source share

If you want one file to be editable and only one to read. Then

 vim writablefile.txt :vs | view readonlyfile.txt 
0
source share

All Articles