aboutsummaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-08-16 23:04:10 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-08-16 23:04:10 +1200
commit5a2d7c57a82a17a763f904d19ea4417696c772bd (patch)
tree6dc3f88f544ffe2c65dd24463b06320e588f81d9 /plugin
downloadvim-equalalways-resized-5a2d7c57a82a17a763f904d19ea4417696c772bd.tar.gz
vim-equalalways-resized-5a2d7c57a82a17a763f904d19ea4417696c772bd.zip
First versionv0.1.0
Diffstat (limited to 'plugin')
-rw-r--r--plugin/equalalways_resized.vim27
1 files changed, 27 insertions, 0 deletions
diff --git a/plugin/equalalways_resized.vim b/plugin/equalalways_resized.vim
new file mode 100644
index 0000000..8865f0a
--- /dev/null
+++ b/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