aboutsummaryrefslogtreecommitdiff
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
downloadvim-equalalways-resized-0.1.0.tar.gz (sig)
vim-equalalways-resized-0.1.0.zip
First versionv0.1.0
-rw-r--r--README.md13
-rw-r--r--VERSION1
-rw-r--r--doc/equalalways_resized.txt21
-rw-r--r--plugin/equalalways_resized.vim27
4 files changed, 62 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..648ea3d
--- /dev/null
+++ b/README.md
@@ -0,0 +1,13 @@
+equalalways\_resized.vim
+========================
+
+This tiny plugin extends `'equalalways'` to rebalance windows when Vim itself
+is resized.
+
+License
+-------
+
+Copyright (c) [Tom Ryder][1]. Distributed under the same terms as Vim itself.
+See `:help license`.
+
+[1]: https://sanctum.geek.nz/
diff --git a/VERSION b/VERSION
new file mode 100644
index 0000000..6e8bf73
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+0.1.0
diff --git a/doc/equalalways_resized.txt b/doc/equalalways_resized.txt
new file mode 100644
index 0000000..4263c39
--- /dev/null
+++ b/doc/equalalways_resized.txt
@@ -0,0 +1,21 @@
+*foldlevelstart_stdin.txt* For Vim version 7.0 Last change: 2018 Aug 16
+
+DESCRIPTION *foldlevelstart_stdin*
+
+This tiny plugin extends 'equalalways' to rebalance windows when Vim itself is
+resized.
+
+REQUIREMENTS *foldlevelstart_stdin-requirements*
+
+This plugin only loads if 'compatible' is not set. It requires the |+autocmd|
+and |+windows| features, with the |VimResized| event introduced in |version7|.
+
+AUTHOR *foldlevelstart_stdin-author*
+
+Written and maintained by Tom Ryder <tom@sanctum.geek.nz>.
+
+LICENSE *foldlevelstart_stdin-license*
+
+Licensed for distribution under the same terms as Vim itself (see |license|).
+
+ vim:tw=78:ts=8:ft=help:norl:
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