Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I want to compare two files(say A and B) side by side(vertically) in in Vim. I open one of those two files(say A) and as per this answer in this site issue a Ctrl+w v . Now both the panels are showing contents of file A. How can I see the contents of A in the left had side and B in the right hand side ? I am using Red Hat Linux if that matters .

share|improve this question
4  
:e <filename> –  Ulrich Dangel Feb 28 '13 at 14:03
2  
From the command line, i.e. if you don't have a vim open already: vimdiff file1 file2. If you don't actually need vimdiff, then vim -O file1 file2. –  jw013 Feb 28 '13 at 16:02
add comment

2 Answers

up vote 4 down vote accepted

You can skip Ctrl+w v and just do:

:vert diffsplit <other_filename>
share|improve this answer
add comment

You must switch panes in vim and then open a new file.

Switch panes with CTRL+W+W.

Once the cursor is in the new pane, open a new file by entering the vim command line and using the open file command.

:e /some/file/name
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.