2 Simplified code by using tabpagebuflist() instead of gettabinfo() and map(..., getwininfo())
source | link

The following code will give you the file names for the current tab (if the buffer in a window is connected to a file):

" Get the windowbuffer IDsnumbers of all windows on the current tab
let windows = gettabinfo(tabpagenr())[0]['windows']
" Get the buffer number for each window
let buffers = map(copytabpagebuflist(windows), {key, val -> getwininfotabpagenr(0 + val)[0]['bufnr']})
" Get the name of each buffer
let buffernames = map(copy(buffers), {key, val -> bufname(val)})
" Print the buffer names
echo buffernames

This needs a sufficiently new version of Vim, which supports lamdas.

The following code will give you the file names for the current tab (if the buffer in a window is connected to a file):

" Get the window IDs of all windows on the current tab
let windows = gettabinfo(tabpagenr())[0]['windows']
" Get the buffer number for each window
let buffers = map(copy(windows), {key, val -> getwininfo(0 + val)[0]['bufnr']})
" Get the name of each buffer
let buffernames = map(copy(buffers), {key, val -> bufname(val)})
" Print the buffer names
echo buffernames

This needs a sufficiently new version of Vim, which supports lamdas.

The following code will give you the file names for the current tab (if the buffer in a window is connected to a file):

" Get the buffer numbers of all windows on the current tab
let buffers = tabpagebuflist(tabpagenr())
" Get the name of each buffer
let buffernames = map(copy(buffers), {key, val -> bufname(val)})
" Print the buffer names
echo buffernames

This needs a sufficiently new version of Vim, which supports lamdas.

1
source | link

The following code will give you the file names for the current tab (if the buffer in a window is connected to a file):

" Get the window IDs of all windows on the current tab
let windows = gettabinfo(tabpagenr())[0]['windows']
" Get the buffer number for each window
let buffers = map(copy(windows), {key, val -> getwininfo(0 + val)[0]['bufnr']})
" Get the name of each buffer
let buffernames = map(copy(buffers), {key, val -> bufname(val)})
" Print the buffer names
echo buffernames

This needs a sufficiently new version of Vim, which supports lamdas.