[vim/vim] The key bindings in register-completion mode differ from those in other completion modes. (Issue #17529)

20 views
Skip to first unread message

h_east

unread,
Jun 12, 2025, 1:53:44 AM6/12/25
to vim/vim, Subscribed
h-east created an issue (vim/vim#17529)

For example, in omni-completion mode, as documented, after pressing i_CTRL-X_CTRL-O, pressing CTRL-O behaves the same as CTRL-N. The same basically applies to the other completion modes.

Omni completion						*compl-omni*
(snip...)
							*i_CTRL-X_CTRL-O*
CTRL-X CTRL-O		Guess what kind of item is in front of the cursor and
			find the first match for it.
	CTRL-O	or
	CTRL-N		Use the next match.  This match replaces the previous
			one.
(snip...)

In the current register-completion mode, after pressing i_CTRL-X_CTRL-R, entering CTRL-R_a will insert the contents of register a. I don't think it makes sense to perform this action during X-mode completion. Shouldn't pressing CTRL-R behave the same as CTRL-N, just like in the other completion modes?

Below is an example of the documentation after the change of i_CTRL-X_CTRL-R.

Completing contents 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-R	or
	CTRL-N		Search forwards for next match.  This match replaces
			the previous one.
(snip...)


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/17529@github.com>

Christian Brabandt

unread,
Jun 12, 2025, 2:16:58 AM6/12/25
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#17529)

This was done in particular after this comment here: #17395 (comment)

To be honest, I have never really understood that part of the documentation referenced:

CTRL-X CTRL-N or
CTRL-X CTRL-P   Further use of CTRL-X CTRL-N or CTRL-X CTRL-P will
                copy the words following the previous expansion in
                other contexts unless a double CTRL-X is used.

so we may need to update and clarify the documentation to match the current behaviour.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/17529/2965253595@github.com>

Maxim Kim

unread,
Jun 12, 2025, 2:24:29 AM6/12/25
to vim/vim, Subscribed
habamax left a comment (vim/vim#17529)

To be honest, I have never really understood that part of the documentation referenced:

It is actually quite convenient in emacs with dabbrev-expand if I remember it correctly.

Basically it completes the next (ctrl-x ctrl-n) word adjacent to the previously completed one:

asciicast


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/17529/2965269665@github.com>

h_east

unread,
Jun 12, 2025, 2:37:05 AM6/12/25
to vim/vim, Subscribed
h-east left a comment (vim/vim#17529)

Register completion (i_CTRL-X_CTRL-R) and register insertion (i_CTRL-R, i_CTRL-R_CTRL-R, etc.) are separate features. Performing register insertion during register completion will cause confusion.
Also, we should maintain the existing completion-mode key behavior, where completion mode key (i.e. CTRL-O) pressed after CTRL-X behaves like CTRL-N.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/17529/2965302121@github.com>

zeertzjq

unread,
Jun 12, 2025, 2:39:37 AM6/12/25
to vim/vim, Subscribed
zeertzjq left a comment (vim/vim#17529)

Some (possibly completion-related) plugins may implement mappings using register insertion.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/17529/2965307419@github.com>

Maxim Kim

unread,
Jun 12, 2025, 3:16:16 AM6/12/25
to vim/vim, Subscribed
habamax left a comment (vim/vim#17529)

I believe register completion should just complete register contents without word->full contents on successive press.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/17529/2965405703@github.com>

berggeist

unread,
Jun 12, 2025, 2:10:50 PM6/12/25
to vim/vim, Subscribed
berggeist left a comment (vim/vim#17529)

I believe register completion should just complete register contents without word->full contents on successive press.

Then it should be possible to have successive CTRL-R to cycle through other registers the same way other completions do.

... and not only if the beginning of a registers content matches but any (even fuzzy) match within a registers content succeeds IMHO.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/17529/2967770464@github.com>

h_east

unread,
Jul 1, 2025, 10:47:24 AM7/1/25
to vim/vim, Subscribed
h-east left a comment (vim/vim#17529)

I wrote a patch as a little break between work tasks.
I've put it on Gist.

Vim: Ctrl-R in register completion mode behaves the same as CTRL-N
https://gist.github.com/h-east/8742fb1f3baac7c87e21334b95b2c62c

I probably won't submit a PR.
Personally I think this behavior provides a better user experience, but I know some people might struggle without being able to use :h i_CTRL-R_= during completion mode.
If there's enough positive feedback, I'll consider it.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/17529/3024359004@github.com>

Maxim Kim

unread,
Jul 1, 2025, 6:28:20 PM7/1/25
to vim/vim, Subscribed
habamax left a comment (vim/vim#17529)

I wrote a patch as a little break between work tasks. I've put it on Gist.

Vim: Ctrl-R in register completion mode behaves the same as CTRL-N https://gist.github.com/h-east/8742fb1f3baac7c87e21334b95b2c62c

I probably won't submit a PR. Personally I think this behavior provides a better user experience, but I know some people might struggle without being able to use :h i_CTRL-R_= during completion mode. If there's enough positive feedback, I'll consider it.

PR would be great


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/17529/3025716839@github.com>

Reply all
Reply to author
Forward
0 new messages