I have multiple launched instances of vifm
. Is it possible to copy a file from one instance to another (using yy
)?
Thanks!
I have multiple launched instances of vifm
. Is it possible to copy a file from one instance to another (using yy
)?
Thanks!
Define a map to save current file:
nmap Wf :!ls -1 %f | while read f ; do printf ":!cp %%s/%%s %%s\n" %d $f '%%d' ; done > ~/.vifm_tmp <cr>
And a second mapping that will source the temporary file:
nmap Pf :source ~/.vifm_tmp<cr>
To copy the file: Wf
in the first vifm instance then Pf
in the second instance. This works with multiple selected (tagged) files but does not work in visual mode.
You can also sync the source directory:
nmap Yd :!printf ":cd %%s\n" %d > ~/.vifm_tmp<cr>
nmap Pd :source ~/.vifm_tmp <cr>
then copy/paste between the panels of the same instance.
BEFORE v0.10
No, you can't do this easily. Instances don't share their run-time state (content of registers in this case), so when you yy file in one of them, other instances are not aware of it.
As a workaround for the cases when you really want this:
:write
to save current state intovifminfo
file.:write
, which will merge states of two instances.:restart
to reload state (this can bring more than just registers) and do p.It's not really something I'd recommend, but it should work and might be acceptable in some cases.
SINCE v0.10
Now there is
'syncregs'
option, which enables one to share registers among instances. Here's its description:So, putting this to your
vifmrc
should be enough:Or just set the option temporarily when you need the sharing.