patch 9.1.1408: not easily possible to complete from register content
Problem: not easily possible to complete from register content
Solution: add register-completion submode using i_CTRL-X_CTRL-R
(glepnir)
closes: #17354
Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt
index 00a09ae..d03d81e 100644
--- a/runtime/doc/index.txt
+++ b/runtime/doc/index.txt
@@ -1,4 +1,4 @@
-*index.txt* For Vim version 9.1. Last change: 2025 May 14
+*index.txt* For Vim version 9.1. Last change: 2025 May 26
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -163,6 +163,7 @@
|i_CTRL-X_CTRL-N| CTRL-X CTRL-N next completion
|i_CTRL-X_CTRL-O| CTRL-X CTRL-O omni completion
|i_CTRL-X_CTRL-P| CTRL-X CTRL-P previous completion
+|i_CTRL-X_CTRL-R| CTRL-X CTRL-R complete words from registers
|i_CTRL-X_CTRL-S| CTRL-X CTRL-S spelling suggestions
|i_CTRL-X_CTRL-T| CTRL-X CTRL-T complete identifiers from thesaurus
|i_CTRL-X_CTRL-Y| CTRL-X CTRL-Y scroll down
diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt
index f3d92b2..553183d 100644
--- a/runtime/doc/insert.txt
+++ b/runtime/doc/insert.txt
@@ -1,4 +1,4 @@
-*insert.txt* For Vim version 9.1. Last change: 2025 May 08
+*insert.txt* For Vim version 9.1. Last change: 2025 May 26
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -649,6 +649,7 @@
11. omni completion |i_CTRL-X_CTRL-O|
12. Spelling suggestions |i_CTRL-X_s|
13. keywords in 'complete' |i_CTRL-N| |i_CTRL-P|
+14. words from registers |i_CTRL-X_CTRL-R|
Additionally, |i_CTRL-X_CTRL-Z| stops completion without changing the text.
@@ -1019,6 +1020,21 @@
completion, for example: >
:imap <Tab> <C-X><C-V>
+
+Completing words from registers *compl-register-words*
+ *i_CTRL-X_CTRL-R*
+CTRL-X CTRL-R Guess what kind of item is in front of the cursor from
+ all registers and find the first match for it.
+ Further use of CTRL-R (without CTRL-X) will insert the
+ register content, see |i_CTRL-R|.
+ 'ignorecase' applies to the matching.
+
+ CTRL-N Search forwards for next match. This match replaces
+ the previous one.
+
+ CTRL-P Search backwards for previous match. This match
+ replaces the previous one.
+
User defined completion *compl-function*
Completion is done by a function that can be defined by the user with the
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index e74c5e8..f0a7e9e 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1,4 +1,4 @@
-*options.txt* For Vim version 9.1. Last change: 2025 May 16
+*options.txt* For Vim version 9.1. Last change: 2025 May 26
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -4658,7 +4658,8 @@
'ignorecase' 'ic' boolean (default off)
global
Ignore case in search patterns, |cmdline-completion|, when
- searching in the tags file, and non-|Vim9| |expr-==|.
+ searching in the tags file, non-|Vim9| |expr-==| and for Insert-mode
+ completion |ins-completion|.
Also see 'smartcase' and 'tagcase'.
Can be overruled by using "\c" or "\C" in the pattern, see
|/ignorecase|.
diff --git a/runtime/doc/tags b/runtime/doc/tags
index e586212..d3c77d1 100644
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -6654,6 +6654,7 @@
compl-keyword insert.txt /*compl-keyword*
compl-omni insert.txt /*compl-omni*
compl-omni-filetypes insert.txt /*compl-omni-filetypes*
+compl-register-words insert.txt /*compl-register-words*
compl-spelling insert.txt /*compl-spelling*
compl-states insert.txt /*compl-states*
compl-stop insert.txt /*compl-stop*
@@ -8425,6 +8426,7 @@
i_CTRL-X_CTRL-N insert.txt /*i_CTRL-X_CTRL-N*
i_CTRL-X_CTRL-O insert.txt /*i_CTRL-X_CTRL-O*
i_CTRL-X_CTRL-P insert.txt /*i_CTRL-X_CTRL-P*
+i_CTRL-X_CTRL-R insert.txt /*i_CTRL-X_CTRL-R*
i_CTRL-X_CTRL-S insert.txt /*i_CTRL-X_CTRL-S*
i_CTRL-X_CTRL-T insert.txt /*i_CTRL-X_CTRL-T*
i_CTRL-X_CTRL-U insert.txt /*i_CTRL-X_CTRL-U*
diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt
index 5223687..578f5e8 100644
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -1,4 +1,4 @@
-*todo.txt* For Vim version 9.1. Last change: 2025 Apr 24
+*todo.txt* For Vim version 9.1. Last change: 2025 May 26
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -4764,7 +4764,6 @@
7 When expanding $HOME/dir with ^X^F keep the $HOME (with an option?).
7 Add CTRL-X command in Insert mode like CTRL-X CTRL-N, that completes WORDS
instead of words.
-8 Add CTRL-X CTRL-R: complete words from register contents.
8 Add completion of previously inserted texts (like what CTRL-A does).
Requires remembering a number of insertions.
8 Add 'f' flag to 'complete': Expand file names.
diff --git a/runtime/doc/usr_24.txt b/runtime/doc/usr_24.txt
index 72f43f0..250bd17 100644
--- a/runtime/doc/usr_24.txt
+++ b/runtime/doc/usr_24.txt
@@ -187,6 +187,7 @@
CTRL-X CTRL-D macro definitions (also in included files)
CTRL-X CTRL-I current and included files
CTRL-X CTRL-K words from a dictionary
+ CTRL-X CTRL-R words from registers
CTRL-X CTRL-T words from a thesaurus
CTRL-X CTRL-] tags
CTRL-X CTRL-V Vim command line
diff --git a/runtime/doc/version9.txt b/runtime/doc/version9.txt
index e03deed..662cb17 100644
--- a/runtime/doc/version9.txt
+++ b/runtime/doc/version9.txt
@@ -1,4 +1,4 @@
-*version9.txt* For Vim version 9.1. Last change: 2025 May 16
+*version9.txt* For Vim version 9.1. Last change: 2025 May 26
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -41586,6 +41586,9 @@
Support for a vertical |tabpanel| window similar to the 'tabline'.
+New Insert-mode completion: |i_CTRL-X_CTRL-R| to complete words from
+registers.
+
*changed-9.2*
Changed~
-------
diff --git a/runtime/doc/vi_diff.txt b/runtime/doc/vi_diff.txt
index 46db57a..ae14968 100644
--- a/runtime/doc/vi_diff.txt
+++ b/runtime/doc/vi_diff.txt
@@ -338,6 +338,7 @@
|i_CTRL-X_CTRL-D| definitions or macros
|i_CTRL-X_CTRL-O| Omni completion: clever completion
specifically for a file type
+ |i_CTRL-X_CTRL-R| words from registers
etc.
Long line support. |'wrap'| |'linebreak'|