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.

autocmd with several negated paths

+1 vote
asked Nov 19 in vifm by anonymous
edited Nov 19 by xaizek

Referred to https://github.com/vifm/vifm/issues/402#issuecomment-460092642

I don't want to compute the size for my network-folder neither the fuse mounted folders

autocmd DirEnter * %select | exe 'normal ga' | %unselect

So I tried the next approach but it is not working and I've failed to find the good one after many combinations

autocmd DirEnter !**/network-folder/**,!**/fuse/** %select | exe 'normal ga' | %unselect 

Thanks so much in advance

1 Answer

+1 vote
answered Nov 19 by xaizek

So I tried the next approach but it is not working

Comma is like an OR operator. It makes the command to be executed when either of the patterns match, not when all of them match.

And there isn't really an AND operator for :autocmd.

So you might have to use something like this:

autocmd DirEnter !**/network-folder/** if expand('%d') != '/home/my/fuse' | %select | exe 'normal ga' | %unselect | endif
commented Nov 22 by Miguel Madrid MencĂ­a

Thanks to your answer I think I've finally got it with the next

autocmd DirEnter * if system("grep -iP 'fuse|network-folder' <<<" . expand("%d")) == "" | %select | exe 'normal ga' | %unselect | endif

I did the question anonymous sorry

Thanks so much again for your awesome support!

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.
...