How to make the two windows equal width when comparing files with command vim -d file1 file2?

enter image description here

How to make the two windows be equal width?


2 Answers 2


You can equalize the size of windows with <c-w>=.


If you want the window widths to remain equal as you change the size of the Vim window, try this in your ~/.vimrc:

if exists("##VimResized")
    if &diff
        au VimResized * wincmd =
  • Upvote for you, as you save me some keystrokes
    – Antony
    Commented Jan 21, 2016 at 21:16
  • Why not set equalalways?
    – Walf
    Commented May 30, 2019 at 0:53
  • 1
    Because I generally don't want my windows of equal width, but I do want them of equal width when comparing two buffers. Also, 'equalalways' doesn't keep the windows of equal width when resizing the Vim window.
    – garyjohn
    Commented May 31, 2019 at 1:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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