Upon opening a new file in an active buffer in the current window, the message line at the very bottom of the screen shows "%f" [New File]
.
How does Vim know that the buffer contains a new file, rather than an existing file? I want to detect this in order to test whether quickfix has correctly parsed a file name from an error message. Since getqflist()
gives 'bufno'
instead of 'filename'
, I can't use filereadable()
for this.
I've also tried checking getbufvar()
but until you actually try to jump to the error with :cc
, any buffers created by quickfix after parsing an error message for a file name are unlisted and getbufvar()
returns an empty dictionary. I want to determine whether the buffer will contain a new or existing file and intervene before jumping to the error and opening the file.