Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hook vim's window resize event?

Tags:

vim

window

If I have a window with vim in it (windows that the window manager uses, not the vim windows), and then do a :vsp or :sp, then resize my window, the splits will not resize. I'd like, that when the window vim is in is resized, for the splits to be resized accordingly (ie. =).

I'm using gvim, but this should probably apply to both vim and gvim.

like image 575
solinent Avatar asked Sep 17 '25 09:09

solinent


1 Answers

There's a VimResized event available for autocommands, so you can use:

autocmd VimResized * exe "normal \<c-w>="

This seems to work fine with gvim, and for shrinking a terminal-based vim. But there's a bit of an issue with enlarging vim within a terminal, it doesn't redraw properly until some other action is taken.

like image 94
qqx Avatar answered Sep 22 '25 07:09

qqx