1

As title. I'm trying to call bd # while it fails when the previous buffer doesn't exist. So my question is how to detect this?

1 Answer 1

3

The previous buffer (any buffer) number can be obtained via

echo bufnr('#')

If the buffer is invalid, this will return -1, otherwise it is the number of the buffer.

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.