My use of this is a little more simplistic (and perhaps commonplace) than Luc Hermitte's.
If you start an instance of gvim with this compiled in (and it is, and has been for a long time, on, e.g., major linux distros like Fedora and Debian), it starts in server mode. I emphasized "gvim" because what I'm about to describe does not seem to apply to a singular vim
instance in a GUI terminal (although I suppose it could be if you use the paramater appropriately).
Anyway, you can then open any file from anywhere in that gvim instance with gvim --remote [file path]
(with no --servername
specified). I'm a fan of this because I don't navigate the filesystem much directly with vim; instead I use an orthodox file browser (midnight commander) -- or rather, piles of them open to different locations since mc
is lightweight and allows for various color scheme skins to simplify differentiating between them (so I tend to have two or three open in separate tabs in at least one GUI terminal). However, I think the same principle will apply to any file browser which allows you some form of customized hotkey you can associate with gvim --remote %f
. In mc
I have it in the user menu, so F2 + e and the highlighted/selected file is sent to the gvim instance.
This gets a little better: If you open a second gvim instance, say, on monitor #2 of the same desktop, or a separate desktop, and perhaps a different colorscheme in that one, and this time give it an explicit --servername foo
, you can send files to that instance instead with:
gvim --servername foo --remote [file path]
Something which may or may not come in handy depending on the scope of what you are doing, etc.