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.

use file-type dependent status line

0 votes
asked Nov 20 in vifm by jose1711

my intention is to include "-> resolved target" in the statusline if the file is a symbolic link. this code below works but is only evaluated once and all my other attempts failed.

if filetype('.') == 'link'
  set statusline="%-40t -> %T %A %u:%g %s (%a free)"
else
  set statusline="%-40t %A %u:%g %s (%a free)"
endif

is there a way how to make status-line dynamically update based on the file under cursor?

thank you, jose

1 Answer

+1 vote
answered Nov 21 by xaizek

The only way to have something dynamic in the status line is to use %{ expr }. However, because there is no ternary operator (cond ? then : else), it's of not much use here.

You could of course use

${ system('my-script '.expand('%c:p')) }

but it will slow things down. Wrapping it using extcached() might make things bearable performance-wise if you really want this:

${ extcached('link-tail', expand('%c:p'), system(expand('my-script %c:p'))) }
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.
...