Get buftype or other buffer option nvim
Don't use nvim_buf_get_option(buf, "buftype")
as that is deprecated.
eg. To check if a buffer is a terminal buffer:
lua
if vim.api.nvim_get_option_value("buftype", { buf = buf }) == "terminal" then
-- Do something with that
end