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

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
by

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'))) }
...