Get The Current Buffer Number For The Current Window In Neovim
October 2023
You can get the buffer number of the current Neovim window with:
In A Script
If you're in a script, use:
b = vim.api.nvim_get_current_buf()
print(b)nvim_get_current_buf()To see the number directly in the Neovim command line use:
:echo nvim_get_current_buf()end of line