Why does “E89: No write since last change” error not occur when commands are joined with bar?

2018-06-06 12:41:45

I have :set hidden set in my ~/.vimrc.

First I did this:

vim foo bar

:bnEnter

ihelloEsc

:bpEnter

:bd#Enter

The :bd# command leads to this error:

E89: No write since last change for buffer 2 (add ! to override)

This is expected behavior.

Then I did this:

vim foo bar

:bnEnter

ihelloEsc

:bp | bd#Enter

:lsEnter

This time :bp | bd#Enter did not lead to any error. The output of :lsEnter shows that the buffer for bar is still present.

Why did the E89 error did not occur in the second set of steps?