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

I'd like to open images using feh from vifm.

In my bash_alias I have a command that configures feh for use in a tiling window manager (suggestions for improvements are welcome):

# Show entire image, scaled down to window size
alias feh='feh --scale-down --title="%f %h/%wpx, zoom: %z, %u of %l"'

In my vifmrc, I have this to associate images with feh:

filetype *.bmp,*.jpg,*.jpeg,*.png,*.gif,*.webp,*.svg,*.svgz,*.xpm,*.pbm,*.ppm,*.ico,*.tif,*.tiff feh %f & %i

But when I open an image with feh from inside vifm, it seems the alias is ignored.

Is this expected behavior?

Can I make vifm use my aliases from bash_alias?

1 Answer

+1 vote
selected by
Best answer

This is how shells work non-interactively.

You can:

  1. Set 'shellcmdflag' to -lc.
  2. Try this: https://github.com/vifm/vifm/blob/master/FAQ#L109
  3. Write a script that will load aliases before running a command and use it for 'shell'

The first one is probably the most convenient.


Thanks, set shellcmdflag=-lc made the alias work in vifm. I get a Background Process Error though when opening an image with feh from vifm: "stty: 'standard input': Inappropriate ioctl for device". But I can silence that by putting feh %c %i & into vifmrc.


The error is a result of calling stty without a terminal.

You can do something like:

if tty -s; then
    stty ...

Thanks xaizek. Let me just say that you're doing a tremendous job of documenting Vifm and providing support for it (and beyond). Thank you