[vim/vim] Visual block column, insert register 0 (a copied line) (Issue #10225)

28 views
Skip to first unread message

duianto

unread,
Apr 19, 2022, 2:56:41 AM4/19/22
to vim/vim, Subscribed

Steps to reproduce

  1. Start gvim.exe
  2. Switch to insert state: i
  3. Type:
abc
123
123
123
  1. Switch to normal state: Esc
  2. Move the cursor to the first line: gg
  3. Copy the first line: yy
  4. Move the cursor to the second line's second character (number) 2: jl (down once and right once)
  5. Enter visual block mode: Ctrl v
  6. Select the column of 2's by moving the cursor down twice: jj
  7. Switch to insert state at the beginning of the block: I (Shift i)
  8. Insert from register 0: Ctrl r 0

Observed

abc
1abc
23
123
123

The copied line: abc
was inserted on the first line, without a leading newline.
Nothing happened on the second and third lines.

Expected behaviour

The copied line should be inserted on every line with a selection.
With a leading new line.

abc
1
abc
3
1
abc
3
1
abc
3

Notes

A leading new line is inserted when the insert state cursor is on the first column.
This is also observed without a selection.

First column

  1. Copy the first line: abc
  2. Move the cursor to the third line's first column
  3. Switch to insert state: i
  4. Insert register 0: Ctrl r 0
abc
123
abc
123
123

Second+ column

There is no leading new line when the insert state cursor is not on the first column.

  1. Copy the first line: abc
  2. Move the cursor to the third line's second column (on the number 2)
  3. Switch to insert state: i
  4. Insert register 0: Ctrl r 0
abc
123
1abc
23
123

Version of Vim

8.2.4779

Environment

Windows 10 21H2

Logs and stack traces

No response


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

Christian Brabandt

unread,
Apr 19, 2022, 9:24:56 AM4/19/22
to vim/vim, Subscribed

Note, that depending on how you yank, the register may be in linewise, characterwise or block mode. To workaround this, you can use setreg() and set the register content correctly for the way to paste it. Or you may use @inkarkat's unconditionalpaste plugin (there are probably other alternatives)


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

Christian Brabandt

unread,
May 28, 2022, 3:35:10 AM5/28/22
to vim/vim, Subscribed

I am closing this, as working 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/10225/1140195543@github.com>

Christian Brabandt

unread,
May 28, 2022, 3:35:13 AM5/28/22
to vim/vim, Subscribed

Closed #10225 as completed.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/10225/issue_event/6696593070@github.com>

Reply all
Reply to author
Forward
0 new messages