by mzs · 2y ago · 0 comments
If on MacOS and you are using the apple native build, 'open -a gVim file' opens each file in the same editor.
If you want to do that on X11 (even macos X11.app) or MS Windows:
https://vimhelp.org/remote.txt.html#remote.txt
Basically (or gvim, yu might want --remote-silent too):
vim --servername foo --remote-silent filename [ filename ... ]
The end of that doc explain you can use either Windows messages or OLE.But the same doc explains how you can completely script vim from the command line:
Tell the remote server "foo" to write all files and exit: vim --servername foo --remote-send '<C-\><C-N>:wqa<CR>'
^\^N is what you press on a keyboard to enter normal mode from every mode except ex mode without a beep.
:wqa means do the command Write All and Quit.
so with --remote-send you can send any sequence of key-strokes to act on buffers.
You probably want to read from https://vimhelp.org/intro.txt.html#notation to learn the fundamentals.
I'd avoid neovim initially until you learn enough to decided if you want it - pros and cons both ways.