My .vimrc contains

set hidden
set shortmess=fotx

I start Vim 7.3 with

vim a b

I modify a (optional), then I save it and switch to the next file with :wn. Then I use :prev to return to the previous file. I modify the file some more (optional) and again run :wn.

The first time I ran :wn, I switched instantly to the next buffer, thanks to shortmess=o. But the second time, I had a two-line prompt and needed to press Enter:

"a" 1854 lines, 56709 characters written
"b" 1854 lines --0%-- (2 of 2)
Press ENTER or type command to continue

There's something going on that I don't understand with the hidden option. When I start Vim, the status line shows

"a" 1854 lines, 56709 characters                              1,1           Top

I get a similar line after switching to b. But after switching back to a with :prev, the status line is different:

"a" 1854 lines --0%-- (1 of 2)                                1,1           Top

If I remove the hidden option, I never see the --0%-- form of the status line, and the shortmess=o option has the desired effect of not requiring a confirmation after :wn. But I do want set hidden, because I want to be able to switch buffers without saving.

Why is set hidden changing the format of the status line? More importantly, why is it causing me to have to acknowledge a :wn by pressing Enter the second time, in spite of set shortmess=fotx still being on? How do I get the benefits of both hidden and shortmess=o?

1 Answer 1


Adding O to shortmess seems to fix this:

set hidden
set shortmess=fotxO

From :help shortmess:

o     overwrite message for writing a file with subsequent message
      for reading a file (useful for ":wn" or when 'autowrite' on)
O     message for reading a file overwrites any previous message.
      Also for quickfix message (e.g., ":cn").

So o only takes effect when writing a file, and O takes effect when reading a file.

Unless I've missed something, this seems to behave as you expect? I do get a different statusline, but I believe this is because the statusline is different when you open a new buffer vs. showing a previously hidden buffer...

PS. I don't have a machine with Vim 7.3, but I tested this with Vim 7.4-633, 7.4-160, and 7.2-411, using a vimrc file with only the hidden and shortmess lines.

  • Hmmm. It works, but I don't understand how the documentation relates to the behavior — the description of o even explicitly states that it applies to :wn. What kind of messages might O overwrite? I don't care about the message that a file has been successfully written, but don't want to miss important messages, like failing to write a file. Apr 26, 2015 at 21:52
  • @Gilles Hm, I'm also slightly confused now ... I need to do some more digging and see how exactly this works ... stay tuned ... Apr 28, 2015 at 8:43

Your Answer

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

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