home ~ projects ~ socials

Get The Name Of The Current File In Neovim

local current_buffer_name = vim.api.nvim_buf_get_name(0)
print(current_buffer_name)
:echo nvim_buf_get_name(0)

Notes

  • Where 0 is for the current buffer
  • Can also pass a buffer number for another buffer
-- end of line --