home ~ projects ~ socials

Get The Current Buffer Number For The Current Window In Neovim

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 --