From caa93b5e1e621e63777def5d9fdd49d613e1c274 Mon Sep 17 00:00:00 2001 From: zeertzjq <zeertzjq@outlook.com> Date: Sun, 15 Dec 2024 07:05:12 +0800 Subject: [PATCH 1/2] vim-patch:ed89206: runtime(doc): add a note about inclusive motions and exclusive selection related: vim/vim#16202 https://github.com/vim/vim/commit/ed89206efe404a94e8424ccfe03c978fd93470f1 Co-authored-by: Christian Brabandt <cb@256bit.org> --- runtime/doc/motion.txt | 7 +++++++ runtime/doc/options.txt | 2 ++ runtime/lua/vim/_meta/options.lua | 2 ++ src/nvim/options.lua | 2 ++ 4 files changed, 13 insertions(+) diff --git a/runtime/doc/motion.txt b/runtime/doc/motion.txt index 48e13d795e..ec4732c05a 100644 --- a/runtime/doc/motion.txt +++ b/runtime/doc/motion.txt @@ -86,6 +86,13 @@ command. There are however, two general exceptions: end of the motion is moved to the end of the previous line and the motion becomes inclusive. Example: "}" moves to the first line after a paragraph, but "d}" will not include that line. + + *inclusive-motion-selection-exclusive* +When 'selection' is "exclusive", |Visual| mode is active and an inclusive +motion has been used, the cursor position will be adjusted by another +character to the right, so that visual selction includes the expected text and +can be acted upon. + *exclusive-linewise* 2. If the motion is exclusive, the end of the motion is in column 1 and the start of the motion was at or before the first non-blank in the line, the diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 6fe208f506..84f0bfe141 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -4982,6 +4982,8 @@ A jump table for the options with a short description can be found at |Q_op|. selection. When "old" is used and 'virtualedit' allows the cursor to move past the end of line the line break still isn't included. + When "exclusive" is used, cursor position in visual mode will be + adjusted for inclusive motions |inclusive-motion-selection-exclusive|. Note that when "exclusive" is used and selecting from the end backwards, you cannot include the last character of a line, when starting in Normal mode and 'virtualedit' empty. diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index fecbece655..63bf0df5f6 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -5214,6 +5214,8 @@ vim.go.sect = vim.go.sections --- selection. --- When "old" is used and 'virtualedit' allows the cursor to move past --- the end of line the line break still isn't included. +--- When "exclusive" is used, cursor position in visual mode will be +--- adjusted for inclusive motions `inclusive-motion-selection-exclusive`. --- Note that when "exclusive" is used and selecting from the end --- backwards, you cannot include the last character of a line, when --- starting in Normal mode and 'virtualedit' empty. diff --git a/src/nvim/options.lua b/src/nvim/options.lua index de152fb315..6dc32658fe 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -7011,6 +7011,8 @@ return { selection. When "old" is used and 'virtualedit' allows the cursor to move past the end of line the line break still isn't included. + When "exclusive" is used, cursor position in visual mode will be + adjusted for inclusive motions |inclusive-motion-selection-exclusive|. Note that when "exclusive" is used and selecting from the end backwards, you cannot include the last character of a line, when starting in Normal mode and 'virtualedit' empty. From 3406b0091122449318cf53c997eacc0621d02ee2 Mon Sep 17 00:00:00 2001 From: zeertzjq <zeertzjq@outlook.com> Date: Sun, 15 Dec 2024 07:09:57 +0800 Subject: [PATCH 2/2] vim-patch:fbe9a69: runtime(doc): Add a reference to |++opt| and |+cmd| at `:h :pedit` closes: vim/vim#16217 https://github.com/vim/vim/commit/fbe9a6903a5b66d5b546a5a080726cba50372df5 Co-authored-by: Yinzuo Jiang <jiangyinzuo@foxmail.com> --- runtime/doc/windows.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt index 24aa7b1b11..a6e5984c82 100644 --- a/runtime/doc/windows.txt +++ b/runtime/doc/windows.txt @@ -985,6 +985,8 @@ CTRL-W g } *CTRL-W_g}* position isn't changed. Useful example: > :pedit +/fputc /usr/include/stdio.h < + Also see |++opt| and |+cmd|. + *:ps* *:psearch* :[range]ps[earch][!] [count] [/]pattern[/] Works like |:ijump| but shows the found match in the preview