I would like to echo the filename before deleting any buffer (:bd
, :q
). I wanted to achieve this by using auto-commands like this:
augroup DummyCodeGroup
autocmd!
autocmd BufDelete * lua print("path", vim.fn.expand('%:p'))
augroup END
But it seems like nothing is printed (just the "path" path). When I am just executing the following:
:lua print("path", vim.fn.expand('%:p'))
Then the right path is printed on the message line.
How can I achieve this? Should I use BufUnload
instead as that's called before the BufDelete
?