Welcome to Vifm Q&A, where you can ask questions about using Vifm. Registration is optional, anonymous posts are moderated. E-mail and GitHub logins are enabled.
0 votes
in vifm by
edited by

I have two directories--dirA and dirB. In the same directory that contains dirA and dirB, I wish to have a relative symbolic link named dir that points to one or the other, switching back and forth as needed.

So I navigate to the directory containing dirA and dirB and execute the command :sync to make them appear in both panes.

Now making the initial link is easy. With dirB highlighted in vifm I execute :rlink dir. Now, in the same directory that contains dirA and dirB there is also a symbolic link dir -> dirB:

lrwxrwxrwx  1 removed removed    4 Jul 23 12:54 dir -> dirB
drwxr-xr-x  2 removed removed 4096 Jul 23 12:53 dirA
drwxr-xr-x  2 removed removed 4096 Jul 23 12:54 dirB

Now, suppose that I wish dir to point to dirA instead. So I move the cursor up one line so that dirA is highlighted and execute :rlink! dir. Note the exclamation mark is included because I wish dir to be overwritten and point to dirA instead.

But this is not what happens. Instead, inside dirB a link named dirA is created that points to ../dirA. I suppose this is happening because the :[range]rlink[!] path form of the command is being used this time.

So this is my question: Is there a way to use :rlink to overwrite the link to make it point to dirA instead?

1 Answer

0 votes
by

If you use rl, then it's possible after jumping through some hoops with prompt and configuration dialog, but :rlink doesn't have any way to change how single argument is interpreted. Probably worth to add an option to :rlink and alike to affect the behaviour.

by

Thanks for the suggestion to use rl. I just tried it and it does work, and it isn't too hard either.

...