[vim/vim] i_CTRL-R CTRL-P insert linewise register as if CTRL-R CTRL-O was used (Issue #18539)

4 views
Skip to first unread message

jrmd54

unread,
11:31 AM (7 hours ago) 11:31 AM
to vim/vim, Subscribed
jrmd54 created an issue (vim/vim#18539)

Steps to reproduce

Hello,

Steps to reproduce the bug:

# 1 - create test file and open it with bare vim
$ echo "aaaaaa" > test
$ echo "bbbbbb" > test
$ vim -u NONE test
# 2 - copy first line 'linewise' in register a by typing V"ay
# 3 - enter insert mode at end of 2nd line by typing jA
# 4 - paste content of register a by typing <c-r><c-p>a

After these steps the content of the test file is

aaaaaa
aaaaaa
bbbbbb

instead of

aaaaaa
bbbbbbaaaaaa

When reading the documentation of i_CTRL-R, it is written that this behavior is what is expected of CTRL-R CTRL-O (while nothing indicates that it should be the same for CTRL-R CTRL-P)

CTRL-R CTRL-O {register}			*i_CTRL-R_CTRL-O*
        Insert the contents of a register literally and don't
        auto-indent.  Does the same as pasting with the mouse
        |<MiddleMouse>|. When the register is linewise this will
        insert the text above the current line, like with `P`.
        The '.' register (last inserted text) is still inserted as
        typed.
        After this command, the '.' register contains the command
        typed and not the text. I.e., the literals "^R^O" and not the
        text from the register.
        Does not replace characters in |Replace-mode|!
                                                                                                                                                                                         
CTRL-R CTRL-P {register}			*i_CTRL-R_CTRL-P*
        Insert the contents of a register literally and fix the
        indent, like |[<MiddleMouse>|.
        The '.' register (last inserted text) is still inserted as
        typed.
        After this command, the '.' register contains the command
        typed and not the text. I.e., the literals "^R^P" and not the
        text from the register.
        Does not replace characters in |Replace-mode|!

Am I right and is this a bug?
If not, is there a way to fix this behavior with some hidden option or flag?

Thank you very much

Expected behaviour

``

Version of Vim

9.1 (2024 Jan 02, compiled Sep 05 2025 19:44:46)

Environment

Operating system: Ubuntu noble
Terminal: Gnome-terminal

Logs and stack traces


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/18539@github.com>

Christian Brabandt

unread,
12:12 PM (6 hours ago) 12:12 PM
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#18539)
# 1 - create test file and open it with bare vim
$ echo "aaaaaa" > test
$ echo "bbbbbb" > test
$ vim -u NONE test
# 2 - copy first line 'linewise' in register a by typing V"ay
# 3 - enter insert mode at end of 2nd line by typing jA
# 4 - paste content of register a by typing <c-r><c-p>a

The problem is, after the first yank, your register is in linewise mode. If you use 0v$y register a would be in character mode and it works as expected.


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/18539/3390987108@github.com>

Reply all
Reply to author
Forward
0 new messages