The way I solved the problem was to request all remote Vim processes for their open buffers. You can use the functionality of the Vim client server for this. GVIM server names are usually called sequentially: GVIM
, GVIM1
, ...; for the Vim terminal, you will have to call them the argument --servername
(for example, through a shell alias).
You can then query the list of open files with the --remote-expr
argument. A simple expression to loop over all of the buffers listed (for example, as shown by :ls
):
map(filter(range(1, bufnr('$')), 'buflisted(v:val) && ! empty(bufname(v:val))'), 'bufname(v:val)')
As you can see, this is a bit related and may affect your workflow for launching Vim. Think about whether you really need it!
source share