Reputation: 800
I use Gvim to write code. And use vifm to make file management ( copy, move files, extract tar's ). Sometimes, when navigating in vifm i need to open some file to edit him. Using :e
it opened vim in same window. Is there any way to open file to edit in already opened gvim program?
Upvotes: 1
Views: 1264
Reputation: 517
Partial solution/workaround (I'm using a mac fwiw):
In vfimrc, define
" yank current file path into the clipboard
nnoremap Cf :!echo -n %c:p | pbcopy %i<cr>
To copy filename and dir into system clipboard
Then in vifm, cursor over file and type
Cf
:!gvim "
<cmd-v>
to paste clipboard, and finish expression with...
"
<enter>
and now that file should open in gvim. It worked for me
Upvotes: 1
Reputation: 172570
You can use Vim's client-server feature to send the :edit
to the existing GVIM instance. In the terminal Vim / vifm, execute:
:!gvim --remote path/to/file
See :help remote.txt
for details. You can also open the file in a new tab page with --remote-tab
etc.
Upvotes: 4