I'm on linux and I'm querying the list of files open in a gvim server so I can pull it up with
gvim --servername <name> --remote <file>
To do so, I wrote a helper function that returns buffers
function! returnbufferlist()
execute "silent redir @m"
execute "silent buffers"
execute "silent redir END"
"execute "<ESC><ESC>"
let a=@m
return a
endfunction
My external script loops through all gvim servers, and runs
gvim --remote-expr 'returnbufferlist()'
I check my filename against the list of buffers, and if it's open in the server, I run
gvim --servername <name> --remote <file>
as above. Is there a more efficient way of doing this? Is there a dbus interface that allows me to do the same thing more efficiently? Now I'm doing some regex matching that's trying to match my filename with the bufferlist, and this doesn't always work as intended since buffers are not listed with full paths.