Get The Current Buffer ID For A Window In Neovim

June - 2021
buffer_id = vim.api.nvim_win_get_buf(0)

The 0 give you the current window.

You can also pass in a window