I want to view the initial copy of the file in a separate window while I make changes to the same file in another window. Is this possible?
1 Answer
As a workaround what you could do is:
:vnew | execute("0read " . @#)
vnew
creates a new buffer in a vertical splitexecute
runs a string as an ex command@#
contains the file name of the alternate-file- read more at
:help alternate-file
- read more at
0read
reads from a file into the first line of a file
Edit:
If you're not making a custom command from this you can do
:vnew | 0read <C-r><C-#>
Both of these require the file to be saved
vim-fugitive
to have latest commit and changes side by side. Otherwise, you'd need to keep the original file as backup and open that backup. Because Vim doesn't have a different view on files, the windows are viewports to the files on disk and nothing more. If you want two windows to have different texts inside them then they must refer to different files.