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?


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
    Jan 21 '16 at 21:16
  • Why not set equalalways?
    – Walf
    May 30 '19 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
    May 31 '19 at 1:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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