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

ls *.txt | vifm - opens vifm custom view containing the file list. How to make grep -n XX *.txt | vifm - opens vifm menu containing the result? (like :!grep -n XX *.txt %M in vifm)

EDIT: vifm -c'!grep -n XX *.txt %M' works! (but needs quoting, unlike pipe syntax)

by

Are you running this command in VIFM command line ?

ls *.txt | vifm -

thx

1 Answer

+1 vote
by
selected by
 
Best answer

There is no equivalent of - for menus. Combining -c with fifos can make pipe syntax work though:

vifmp()
{
    rm -f /tmp/vifm.pipe
    mkfifo /tmp/vifm.pipe
    ( cat > /tmp/vifm.pipe ; rm /tmp/vifm.pipe ) &
    vifm -c '!cat /tmp/vifm.pipe %M' < /dev/tty
}
by
edited by

Thanks for the idea (and, of course, for making vifm). Now I can use

vifmp() { vifm -c'!%M <'<(cat) "$@" </dev/tty; }
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.
...