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?
Asked
Active
Viewed 1,173 times
1

Ashwin Nanjappa
- 76,204
- 83
- 211
- 292

user3583807
- 766
- 1
- 8
- 26
2 Answers
4
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.

Ingo Karkat
- 167,457
- 16
- 250
- 324
-
I read "remote.txt" but not find answer to next question. I bind ":!gvim --remote %c" command to some key and now i can open file to edit very quickly. But i need to press N to get focus on Gvim. Can i do it automatically from vifm? – user3583807 Aug 21 '14 at 07:28
-
@user3583807: Please don't ask follow-up questions in the comments; submit a new (full) question. – Ingo Karkat Aug 23 '14 at 19:56
1
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

daaronr
- 507
- 1
- 4
- 12