Vifm. Edit file in opened gvim

1.2k views Asked by At

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?

2

There are 2 answers

2
Ingo Karkat On BEST ANSWER

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.

0
daaronr On

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