1

When I perform multiple shift :> operations, vim shows me a notification for each line that's shifted. Is there a way to avoid these multiple notifications?

For example, I'm currently editing a file that's about 200,000 lines long. About 99% of the lines contain the pattern "4111". (The specific numbers and string aren't important.) I want to shift all the lines containing "4111" to the right using the :> command.

When I type:

:g/1444/>

I get a notification for each affected line:

1 line >ed 1 time
1 line >ed 1 time
1 line >ed 1 time
1 line >ed 1 time
1 line >ed 1 time
...

I would have to type <space> several thousand times to dismiss all the notifications.

By contrast, if I instead use a substitution command to achieve the same effect:

:g/4111/s/^/    /

(I have set shiftwidth=4) it performs all the substitutions in a couple of seconds and prints:

208295 substitutions on 208295 lines

As you can see I have a workaround, but is there a way to use the :> command on multiple lines and not have to dismiss notifications for each affected line?

I see this problem with vim 8.2 and 9.0. I've seen it before with other versions. (I think it's a bug in vim, which I'll report after getting some feedback here.)

7
  • The former commands runs one :> for each matching line. There may be a shortmess flag you can use to silence it, or use :silent >. Otherwise I would try pressing : or Esc instead of Space for the messages.
    – D. Ben Knoble
    Feb 17 at 23:58
  • @D.BenKnoble If I press : or Esc, it stops shifting. :silent g/4111/>/> works, but it's annoying to type that every time. Do you know of some rationale for why > is more verbose than s? Feb 18 at 0:09
  • You could also do g/4111/norm >>
    – Wilson
    Feb 18 at 1:51
  • 2
    :verbose set report?
    – Matt
    Feb 18 at 4:16
  • Apparently, this is due to your personal (mis-)configuration.
    – Matt
    Feb 18 at 4:17

1 Answer 1

2

The messages are due to custom :h 'report' option setting. Just keep it set to default set report&.

1
  • To be precise, I had set report=0 in my .vimrc. Commenting out that line corrected the problem. Feb 18 at 9:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.