Search code examples
vifm

Can I copy a file from one instance of vifm to another?


I have multiple launched instances of vifm. Is it possible to copy a file from one instance to another (using yy)?

Thanks!


Solution

  • 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:

    1. (in dst instance) Run :write to save current state into vifminfo file.
    2. (in src instance) Do yy and then :write, which will merge states of two instances.
    3. (in dst instance) Run :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:

    Specifies identifier of group of instances that share registers between each other. When several instances of vifm have this option set to identical value, they automatically synchronize contents of their registers on operations which use them.

    So, putting this to your vifmrc should be enough:

    set syncregs=general
    

    Or just set the option temporarily when you need the sharing.