Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Split vim window with one file read/write and one file read-only [closed]

Tags:

vim

I am editing a file using vim. I want to open another file (which currently exists) from within the same vim session and split my screen doing so. I want it to be read-only because I don't want to risk accidentally editing it.

If I try :sp another_file.txt, it opens it in read/write mode.

How do I do this?

like image 653
irritable_phd_syndrome Avatar asked Mar 04 '16 12:03

irritable_phd_syndrome


1 Answers

:view command is what you are looking for. It opens buffer in readonly mode.

You can try :sv file.txt to open file in split window.

like image 94
Kent Avatar answered Sep 28 '22 15:09

Kent