14

I like to use vimdiff as a git diff/merge tool. The problem is when I resize the host terminal window to a new size: of the two split panes, the leftmost remain of the same width, while the rightmost is extended to full window size.

Is there a command to make the split panes equal width after the windows has been resized? Or a setting that makes the panes always be of same size? I looked into :set equalalways but it does not seem to do what I am asking.

18

To go along with @janos's answer, you can set an autocmd to automatically press those keys when the window is resized (put this in your .vimrc without the leading colon if you want it to apply every time you open Vim):

:autocmd VimResized * wincmd =

Here are the docs for the VimResized autocmd.

  • 2
    i couldn't make it work with <C-v> <C-w>; I used autocmd VimResized * wincmd = in my .vimrc instead – guido Feb 3 '15 at 23:18
  • I had the same problem as guido did with ^W and <C-w> not working. If you don't mind, I edited your answer to show the other method. Feel free to review this change, or rollback if you disagree. – DJMcMayhem Aug 9 '16 at 22:37
11

Ctrlw= will resize the split panes to become equal. But I don't know how to make them equal automatically, triggered when the window is resized.

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.