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

I would like to automate some task directly by executing predefined command when selecting a boomarks, then going to bookmark path, is that possible?

1 Answer

0 votes
by

You can't associate commands with bookmarks. If it's the same command for each bookmark, can run it first in a custom :command. DirEntry on bookmark location can also be used, but it's triggered on every change of directory with matching path.

by

could be implemented in the future? what I'm trying to achieve in my specific case is to automount a target if its bookmark path is not currently available. Thank you anyway!

by

right now I was able to configure a DirEntry command to automount the target as the mountpoint directory is entered: it would be awesome if that could work with bookmarks pointing to subdirectories of that DirEntry folder, something like this

autocmd DirEnter /etc/**/* !mount /dev/sda1 /mnt/disk

/mnt/disk/folder1
bmark folder1

would mount sda1 when entering the bookmark folder1

by

DirEnter is triggered after entering some path, so it doesn't happen for directories that don't exist. Sounds like DirEnterPre that happens before target existence checks could help and this doesn't need to be bookmark-specific.

by
edited by

so could DirEnterPre be triggered on bookmark selection somehow but before the existence check? I need to mount the target on that specific way (otherwise I could have automated it shell-wise)

edit I tried that command but it gives me

No such event: DirEnterPre

cannot find it even in the manual

by

Sorry for misunderstanding. It's not there, it's something that could be added.

by

oh, do not be sorry, english is not my first language and I thought you were suggesting me to use that. Anyway such a command would be immensely awesome to get implemented <3

If you would like to make a bug report or feature request consider using GitHub, SourceForge or e-mail. Posting such things here is acceptable, but this is not a perfect place for them.
...