I want to detect from a BufEnter
autocommand whether the buffer is a netrw directory listing.
It seems that when the autocommand is fired, the filetype
is empty and there are no netrw-related buffer variables. Furthermore the bufname()
is empty. However when I manually look at the filetype
it is "netrw"
, the b:netrw_curdir
variable is set, and the buffer has a name (the directory it shows).
How can I determine during the autocommand when the buffer is a netrw directory listing?
This is on Vim 9.0.1276.