Skip to content

Merging statfmt and rulerfmt #2057

@CatsDeservePets

Description

@CatsDeservePets

What is the point in having two separate settings, statfmt and rulerfmt, to customise the bottom bar that act almost identical and only real difference being the placement (while also having promptfmt which does partly support alignment).
Ideally, there would be one single setting which allows for simple alignment and supports the options of statfmt and rulerfmt.

The discussion came up in #2021 (comment) while asking myself, where the new Mode expansion should go. rulerfmt seems like the obvious choice, but it is on the right while all the Vim like applications traditionally place their mode indicator on the bottom left. In the linked comment, @joelim-work mentioned he was not against merging them.

I also want to point out what @gokcehan wrote about statfmt and lf in general, which made me sad and should be kept in mind while discussing this topic: #1347 (comment)

Related links:

The problems:

I am unsure, how this merge could be done without breaking backwards compatibility.
Some letters have a different meaning in both formats, so which one to keep? Which one to reassign?
Should we use one of the existing variables (rulerfmt being the obvious choice)?
Re-introducing ruler and deprecating statfmt and rulerfmt seems also quite ironic as it was depreciated in favour of rulerfmt.

While there are more topics in want to discuss relating to the statusbar (like introducing a filename flag and an alternate version of %h which returns an empty string when the hidden count is 0) I would love to get some input about the merging part first.

Below is an overview of each options capabilities:

Rulerfmt

location:

bottom right corner

Special expansions:

  • %a as the pressed keys
  • %c as the number of files to be copied
  • %d as the amount of free disk space remaining
  • %f as the filter
  • %h as the number of files hidden in the current directory
  • %i as the position of the cursor
  • %m as the number of files to be cut (moved)
  • %p as the progress of file operations
  • %P as the scroll percentage
  • %s as the number of selected files
  • %t as the number of files shown in the current directory
  • %v as the number of visually selected files

Additional expansions:

are provided for environment variables exported by lf, in the form

  • %{lf_<name>} (e.g. %{lf_selmode}) environment variables exported by lf
  • %{lf_user_<name>} (e.g. %{lf_user_foo}) user-defined options

Additional information:

The | character splits the format string into sections. Any section containing a failed expansion (result is a blank string) is discarded and not shown.

Statfmt

location:

bottom left corner

Special expansions:

  • %c as the link count
  • %g as the group
  • %l as the link target
  • %m as the current mode
  • %M as the current mode but also shown in Normal mode (displaying NORMAL instead of a blank string)
  • %p as the file permissions
  • %s as the file size
  • %S as the file size but with a fixed width of four characters (left-padded with spaces)
  • %t as the last modified time
  • %u as the user

Additional expansions:

none

Additional information:

The | character splits the format string into sections. Any section containing a failed expansion (result is a blank string) is discarded and not shown.

Conflicts:

%c, %m, %p, %s, %t

Promptfmt (for good measure and comparison)

location:

top line.(allows alignment)

Special expansions:

  • %d as the working directory with a trailing path separator
  • %F as the current filter
  • %f as the file name
  • %h as the hostname
  • %S may be used once and will provide a spacer so that the following parts are right aligned on the screen
  • %u as the user name
  • %w as the working directory

Additional information:

The home folder is shown as ~ in the working directory expansion.
Directory names are automatically shortened to a single character starting from the leftmost parent when the prompt does not fit the screen.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions