aboutsummaryrefslogtreecommitdiff
path: root/vim/plugin/equalalways_resized.vim
blob: 8865f0af64a6f7f4fdb3d72d17f72cfd04e7eb26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"
" equalalways_resized: If 'equalalways' is set, extend it to VimResized
" events.
"
" Author: Tom Ryder <tom@sanctum.geek.nz>
" License: Same as Vim itself
"
if exists('g:loaded_equalalways_resized') || &compatible
  finish
endif
if !has('autocmd') || !has('windows') || !exists('##VimResized')
  finish
endif
let g:loaded_equalalways_resized = 1

" If 'equalalways' is set, rebalance the windows
function! s:Rebalance() abort
  if &equalalways
    wincmd =
  endif
endfunction

" Add hook for VimResized event
augroup equalalways_resized
  autocmd!
  autocmd VimResized * call s:Rebalance()
augroup END