Welcome to Vifm Q&A, where you can ask questions about Vifm usage. Registration is optional, anonymous posts are moderated. GitHub or Google logins are enabled.
0 votes
in vifm by
edited by

I already tried a command workaround:

command! cplink cp -rL %d/%f %D

But maybe there is a way to change the default copy behavior?

1 Answer

0 votes
by

But maybe there is a way to change the default copy behavior?

Nothing builtin for that. Symlinks are always copied as symlinks. You can try mapping copying like

nnoremap <silent> yd gfyy<c-o>

Where "yd" is for "yank deep". It's not optimal, but seems to work.

by

Yes, this would work for how I put the initial question. Maybe I need to explain, where my motivation comes from:
I am often in a situation, where I work with remote machines. Vifm allows for convenient remote connections via sshfs. Typically, on the remote machine I am faced with some kind of "data-versioning-control", i.e. files are neatly sitting in a project folder, but are only represented by symlinks, pointing to some central location with a hash-value naming convention. For instance:
interesting_file.ext -> /path/to/central/folder/46/8a8b8c98f89d8989e
Hence I used the cp -Lr approach to dereference the symbolic link and keep the name of the link-file. Your proposal works fine, however, it will take over the actual file name, which is in this case a hash-value.

by

Right, abusing yanking won't work then, but we can try abusing putting instead:

nnoremap <silent> pd :!cp -rL %r" %d<cr>
...