summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorLuuk van Baal <luukvbaal@gmail.com>2022-09-11 16:59:53 +0100
committerBram Moolenaar <Bram@vim.org>2022-09-11 16:59:53 +0100
commit29ab524358ba429bcf6811710afc97a978641f0b (patch)
tree768c0de26e9a03fd9331fc4e74d4644312d94756 /runtime
parent9510d22463055f56548ff461ccbc54caa1ba1a2f (diff)
downloadvim-git-29ab524358ba429bcf6811710afc97a978641f0b.tar.gz
patch 9.0.0445: when opening/closing window text moves up/downv9.0.0445
Problem: When opening/closing window text moves up/down. Solution: Add the 'splitscroll' option. When off text will keep its position as much as possible.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/options.txt12
-rw-r--r--runtime/doc/quickref.txt1
-rw-r--r--runtime/optwin.vim2
3 files changed, 15 insertions, 0 deletions
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index b60abc271..336d4497d 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -7499,6 +7499,18 @@ A jump table for the options with a short description can be found at |Q_op|.
When on, splitting a window will put the new window right of the
current one. |:vsplit|
+ *'splitscroll'* *'spsc'* *'nosplitscroll'* *'nospsc'*
+'splitscroll' 'spsc' boolean (default on)
+ global
+ The value of this option determines the scroll behavior when opening,
+ closing or resizing horizontal splits. When "on", splitting a window
+ horizontally will keep the same relative cursor position in the old and
+ new window, as well windows that are resized. When "off", scrolling
+ will be avoided to stabilize the window content. Instead, the cursor
+ position will be changed when necessary. In this case, the jumplist
+ will be populated with the previous cursor position. Scrolling cannot
+ be guaranteed to be avoided when 'wrap' is enabled.
+
*'startofline'* *'sol'* *'nostartofline'* *'nosol'*
'startofline' 'sol' boolean (default on)
global
diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt
index 67fc28e17..2cc2358e9 100644
--- a/runtime/doc/quickref.txt
+++ b/runtime/doc/quickref.txt
@@ -919,6 +919,7 @@ Short explanation of each option: *option-list*
'spellsuggest' 'sps' method(s) used to suggest spelling corrections
'splitbelow' 'sb' new window from split is below the current one
'splitright' 'spr' new window is put right of the current one
+'splitscroll' 'spsc' determines scroll behavior when splitting windows
'startofline' 'sol' commands move cursor to first non-blank in line
'statusline' 'stl' custom format for the status line
'suffixes' 'su' suffixes that are ignored with multiple match
diff --git a/runtime/optwin.vim b/runtime/optwin.vim
index c83b06b31..6b9b5fec9 100644
--- a/runtime/optwin.vim
+++ b/runtime/optwin.vim
@@ -515,6 +515,8 @@ call <SID>AddOption("splitbelow", gettext("a new window is put below the current
call <SID>BinOptionG("sb", &sb)
call <SID>AddOption("splitright", gettext("a new window is put right of the current one"))
call <SID>BinOptionG("spr", &spr)
+call <SID>AddOption("splitscroll", gettext("determines scroll behavior when spliting windows"))
+call <SID>BinOptionG("spsc", &spsc)
call <SID>AddOption("scrollbind", gettext("this window scrolls together with other bound windows"))
call append("$", "\t" .. s:local_to_window)
call <SID>BinOptionL("scb")