9

From time to time I see something like in the status bar when I open a file:

"Gemfile" 112L, 2941C
"Gemfile" 112 lines --62%--
Press ENTER or type command to continue

Where is it coming from? How to disable it forever?

This is seriously getting out of hand, I am editing wrong lines in files because when I switch to the file it is off by one line.

Update

When multiple files are opened in buffers and you bring Vim to foreground especially after some changes like git merge Vim seem to reload files.

Settings cmdheight to 2 doesn't help because there might be more messages. This is what I just had after merge:

NORMAL  +3 ~9 departments  ... STATUS BAR
"app/assets/stylesheets/_menu.sass.erb" 144L, 3372C
"app/assets/stylesheets/_users.sass" 120L, 2110C
"spec/factories/users.rb" 19L, 469C
Press ENTER or type command to continue

There should be a way to get rid of this.

3
  • 5
    That looks like the information vim normally prints when loading a file, though it's interesting it's being printed twice. Does it still happen when you run with -u NONE?
    – user72
    Apr 6, 2015 at 18:10
  • I don't think it is supposed to wait for me to press Enter as well. No, it's some plugin I think. Guess have to find out what's causing it. The problem is - I don't see that every time.
    – firedev
    Apr 7, 2015 at 7:34
  • 2
    The "press enter" prompt makes sense; it will do that when there is more text to display than would fit, as there is in this case since its displaying a bunch of extra info. See :help press-enter.
    – user72
    Apr 7, 2015 at 15:04

3 Answers 3

6

This is controlled with the shortmess option. In particular, you probably want to set the O (upper-case o) flag with set shortmess+=O.

O     message for reading a file overwrites any previous message.
      Also for quickfix message (e.g., ":cn").

Note that this is included in the Vim default, which is filnxtToO. So I think you either added this to your vimrc some time in the past and forgot about it, or some plugin is resetting it. In How do I debug my vimrc file? you can find some tips on how to figure out where this is being reset.

Also see :help 'shortmess'. And this question is almost exactly the same.

2
  • ........... eh?
    – markling
    Dec 16, 2021 at 11:24
  • 1
    @markling Eh, what? Dec 17, 2021 at 8:48
2

So I kind of alleviated it by using

:set cmdheight=2

But that is weak sause and I don't think should be the answer.

Update Yep, the next day I had 3 files changed and it asked me to press enter again.

1
  • I think that use 3 is better, because sometimes more than 2 lines are shown. For me many times xD
    – adelarsq
    Dec 28, 2015 at 18:21
1

Thanks for the answer from @Matin Tournoij. For me, set shm+=O didn't work, however, set shm+=F works.

The help information for this option:

F don't give the file info when editing a file, 
like `:silent` was used for the command; 
note that this also affects messages from autocommands
1

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.