Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rulerfmt option for improved ruler customization #1386

Merged
merged 8 commits into from
Sep 3, 2023
Merged

Add rulerfmt option for improved ruler customization #1386

merged 8 commits into from
Sep 3, 2023

Conversation

joelim-work
Copy link
Collaborator

Description

While the current ruler option can be used to configuring the contents of the ruler, it lacks the ability to customize styles and colors, and is also inconsistent with other UI options such as promptfmt and statfmt. This change builds upon the existing design of statfmt and applies it to the ruler, and encourages the deprecation of the existing ruler option.

Specification

  • Placeholders for internal data
    • %a is the pressed keys
    • %p is the progress of file operations
    • %m is the number of files to be cut (moved)
    • %c is the number of files to be copied
    • %s is the number of selected files
    • %f is the filter
    • %i is the position of the cursor
    • %t is the number of files shown in the current directory
    • %h is the number of files hidden in the current directory
    • %d is the amount of free disk space remaining.
  • Placeholders for options
    • %{lf_<name>} for the value of options (e.g. %{lf_selmode})
    • %{lf_user_<name>} for the value of user-defined options (e.g. %{lf_user_foo})
  • Formatting for optional fields
    • Use | to divide the ruler into sections
    • Any section containing a failed placeholder substitution (blank result) is omitted

Examples

Display information about the cursor position:

set rulerfmt "%i/%t"

Display the number of cut/copied/selected files, only if there are any:

set rulerfmt "  cut: %m|  copy: %c|  select: %s"

Display the filter in blue with reversed colors:

set rulerfmt "\033[7;34m%f\033[0m"

Display the filter in blue with reversed colors and surrounded by spaces:

set rulerfmt "\033[7;34m %f \033[0m"

Display the value of the selmode option:

set rulerfmt "%{lf_selmode}"

Display the value of a user defined option:

set rulerfmt "%{lf_user_greet}"
set user_greet "Hello, World!"

@joelim-work joelim-work merged commit 439fb03 into gokcehan:master Sep 3, 2023
4 checks passed
@joelim-work joelim-work deleted the rulerfmt branch September 3, 2023 03:31
This was referenced Sep 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show number of hidden items in the ruler
1 participant