[vim/vim] Indent and visual block append give wrong text when appending indentkeys (#8659)

20 views
Skip to first unread message

allafesta

unread,
Jul 29, 2021, 12:43:59 PM7/29/21
to vim/vim, Subscribed

Description
When using visual block mode to append text to lines with a wrong indentation, typing indentkeys causes the line being typed on to indent. This indent is not transferred to the other lines, instead part of the typed line is transferred to the other lines. I noticed this in Verilog files, did not look too much into other file types.

To Reproduce

  1. Run vim --clean test.v
  2. Type
always @()
12
34
  1. set cursor at 2 then <C-v> j A begin <esc> (include a space so begin is registered as a keyword)
  2. The text now looks like
always @()
        12 begin
34	12 begin

Expected behavior
Last line should look like

	34 begin

Environment (please complete the following information):

  • Vim version:
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled May 28 2021 06:58:52)
Included patches: 1-2891
Compiled by Arch Linux
  • OS: Arch Linux
  • Terminal: Konsole

Additional context
The minimal example is incorrect Verilog syntax. The reason I found this was because a plugin set ; as an indentkey.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

Christian Brabandt

unread,
Jul 29, 2021, 1:09:05 PM7/29/21
to vim/vim, Subscribed

Hm, Vim should abort block append once it notices that indenting kicked in. And it seems to do so for me with 8.2.3161

allafesta

unread,
Jul 29, 2021, 4:00:14 PM7/29/21
to vim/vim, Subscribed

Could be it was patched already then. Apologies for taking up your time.

allafesta

unread,
Jul 29, 2021, 4:00:26 PM7/29/21
to vim/vim, Subscribed

Closed #8659.

Christian Brabandt

unread,
Jul 29, 2021, 4:08:25 PM7/29/21
to vim/vim, Subscribed

I don't know. What you can do is temporarily enable paste mode. Then block edit should work without indenting kicking in. BTW: For me I see the same behaviour on 8.2.2844 I see this:

always @()
        12 begin
34

so Vim correctly stopped block append. This may not be the desired behaviour either, however. It just safely aborts because the indention may confuse Vim and lead to results you saw. I don't know why this would still happen, IIRC it should behave like that for a long time.

Reply all
Reply to author
Forward
0 new messages