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

as a long-term mc user i am trying to make a smoother transition by trying to set vifm so it looks very much like this file manager.

so far i've applied the following changes:

  • https://github.com/vifm/vifm-colors/blob/master/mc-like.vifm
    looks quite similar to the theme of the original mc
  • set viewcolumns=-{name},12{size},19{mtime}
    did not find a way how to tell vifm to format dates/times the way ls -l does that
  • set sizefmt=units:si,precision:3
    not exactly the same either
  • windo set timefmt=│%b\ %d\ %Y\ %H:%M│and set fillchars=vborder:│
    attempt to add bars to the output, it would be much better if viewcolumns supports custom characters in the format string

is there anything more i could do?

1 Answer

0 votes
by

did not find a way how to tell vifm to format dates/times the way ls -l does that

You mean when it prints either time or year? Didn't notice it before (and I use long-iso time format there either way). I don't think this can be done via 'timefmt', there is probably no sequence to do it.

set sizefmt=units:si,precision:3
not exactly the same either

For me mc just displays size in bytes.

it would be much better if viewcolumns supports custom characters in the format string

You want to do something like this?

viewcolumns=*{name}..,│,12{size},│,6{}.

is there anything more i could do?

If you're asking about something not mentioned above, then I don't know as I haven't used mc beyond doing a couple of primitive operations.

by

thank you, is there a plugin how-to? i don't see those yet installed, or where the plugins belong in the structure of user files. the documentation only mentions plugin for vim (for opening a file using vifm).

by
by

Thank you, this is even closer! However there's a bit of inaccuracy in LsTime. The definition is more like.. display year (instead of time) if the more than a year (365d) has passed. So I get a time for a date in 2020 even if we have 2021:
$ date; ls -ld system-connections Sat Mar 20 23:09:48 CET 2021 drwx------ 2 root root 4096 Nov 29 14:35 system-connections
vifm currently shows nov 29 2020.

by

Here's an updated function:

local secsPerYear = 365*24*60*60
local function lsTime(info)
    local time = info.entry.mtime
    local ageYears = os.difftime(os.time(), time)//secsPerYear
    if ageYears == 0 then
        return os.date('%b %d %H:%M', time)
    else
        return os.date('%b %d  %Y', time)
    end
end
by

Thank you, that worked nicely!

...