diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-08-01 19:47:51 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-08-01 19:47:51 +1200 |
commit | 2dcd31235a33c1b2df2fe33dceb428c88c119a88 (patch) | |
tree | ebbfc703b433235117551f9140265924f3c2ffd3 | |
parent | Remove trailing space from Vim plugin (diff) | |
download | dotfiles-2dcd31235a33c1b2df2fe33dceb428c88c119a88.tar.gz dotfiles-2dcd31235a33c1b2df2fe33dceb428c88c119a88.zip |
Add equalalways_resized.vim plugin
Extend the 'equalalways' option to rebalance the windows when Vim is
resized.
-rw-r--r-- | vim/plugin/equalalways_resized.vim | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/vim/plugin/equalalways_resized.vim b/vim/plugin/equalalways_resized.vim new file mode 100644 index 00000000..8865f0af --- /dev/null +++ b/vim/plugin/equalalways_resized.vim @@ -0,0 +1,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 |