Quick and dirty way of "storing a list of open files", as requested in your comment. (I don't have enough reputation to answer a comment).
gives all currently open filenames, arranged by tab number.
So if you do something like
command! SaveTabs :execute "redir! > tabs_" . v:servername . ".txt
\ | echo v:servername strftime(\"%c\") | pwd | tabs | redir END"
you will have a new command
which will create a file named something like
tabs_GVIM27.txt (yeah that's how many servers I have open...) containing all the filenames, with a "header" at the top with the:
- current working directory
- date/time that the list was created.
When in a new/different session later on, you can open the tabs file in a window and
<c-w>f on any of those filenames to open a new split on the file, effectively "importing" it into your current session.
- If you want you could put the date/time in the filename itself, see
- Put the list on the clipboard instead of in a file: use
redir @+ instead of
Other explanatory notes:
- The working directory is because
:tabs shows relative paths, so files in the working directory do not have their paths (but others do)
:execute is needed because
:redir won't allow variables in its argument
- The command doesn't have to be split over two lines, I just did that so it would be easier to read here
Insane variation for importing all the files at once:
If you want to import all the files at once you can probably do something like
grep "^ " tabs_OLD.txt | xargs | vim --servername NEW --remote-silent
(untested but you get the idea)
(actually if you got that working, you could then just define it as an alias in your shell, so you could in future just type
addfiles foo bar
to add all the files from a previous vim server "foo" to a currently-running vim server called "bar")