Skip to content
CatsDeservePets edited this page Feb 8, 2026 · 7 revisions

The ruler (statusbar) at the bottom can be customized by setting rulerfile to the path of a ruler file. The file is a Go template and follows its syntax. More details about the syntax can be found in the documentation.

Note

A non-empty rulerfmt makes lf ignore rulerfile and render the ruler using legacy format strings (i.e. statfmt and rulerfmt).

Basics

Default ruler

{{with .Message -}}
    {{. -}}
{{else with .Stat -}}
    {{.Permissions | printf "\033[36m%s\033[0m" -}}
    {{with .LinkCount}} {{.}}{{end -}}
    {{with .User}} {{.}}{{end -}}
    {{with .Group}} {{.}}{{end -}}
    {{.Size | humanize | printf " %5s" -}}
    {{.ModTime | printf " %s" -}}
    {{with .Target}} -> {{.}}{{end -}}
{{end -}}
{{.SPACER -}}
{{with .Keys}}  {{.}}{{end -}}
{{with .Progress}}  {{join . " "}}{{end -}}
{{with .Copy}}  {{len . | printf "%s %d \033[0m" $.Options.copyfmt}}{{end -}}
{{with .Cut}}  {{len . | printf "%s %d \033[0m" $.Options.cutfmt}}{{end -}}
{{with .Select}}  {{len . | printf "%s %d \033[0m" $.Options.selectfmt}}{{end -}}
{{with .Visual}}  {{len . | printf "%s %d \033[0m" $.Options.visualfmt}}{{end -}}
{{with .Filter}}  {{join . " " | printf "\033[7;34m %s \033[0m"}}{{end -}}
{{printf "  %d/%d" .Index .Total}}

Equivalent statfmt+rulerfmt configuration:

set statfmt "\033[36m%p\033[0m| %c| %u| %g| %S| %t| -> %l"
set rulerfmt "  %a|  %p|  \033[7;31m %m \033[0m|  \033[7;33m %c \033[0m|  \033[7;35m %s \033[0m|  \033[7;36m %v \033[0m|  \033[7;34m %f \033[0m|  %i/%t"

Display options

sizeunits={{.Options.sizeunits}}

Display user options

Note

Add set user_foo bar to the lfrc file.

foo={{.UserOptions.foo}}

Display environment variables

LF_LEVEL={{env "LF_LEVEL"}}

Split into different sections

left{{.SPACER}}middle{{.SPACER}}right

Padding with spaces

{{printf "[%-8s][%8s]" "left" "right"}}

Colors and styles

{{printf "\033[4;31m%s\033[0m" "hello world"}}

Conditional logic

{{with .Stat -}}
    {{.Path}}{{if .Target}} -> {{.Target}}{{end}}
{{else -}}
    empty directory
{{end -}}

Display option if set

{{if eq .Options.hidden "true" -}}
    hidden
{{end -}}

Different colors for modes

{{$color := 32 -}}
{{if eq .Mode "VISUAL" -}}
    {{$color = 34 -}}
{{end -}}

{{printf "\033[7;%dm %s \033[0m" $color .Mode}}

Different colors for file permissions

{{with .Stat -}}
    {{printf "\033[34m%s" (substr .Permissions 0 1) -}}
    {{printf "\033[33m%s" (substr .Permissions 1 1) -}}
    {{printf "\033[31m%s" (substr .Permissions 2 1) -}}
    {{printf "\033[32m%s" (substr .Permissions 3 1) -}}
    {{printf "\033[33m%s" (substr .Permissions 4 1) -}}
    {{printf "\033[31m%s" (substr .Permissions 5 1) -}}
    {{printf "\033[32m%s" (substr .Permissions 6 1) -}}
    {{printf "\033[33m%s" (substr .Permissions 7 1) -}}
    {{printf "\033[31m%s" (substr .Permissions 8 1) -}}
    {{printf "\033[32m%s" (substr .Permissions 9 1) -}}
    {{printf "\033[0m"}}
{{end -}}

Comments

{{/* this is a comment */ -}}
this will be shown

Community themes

Vim-like statusline

  • tokyo-night colorscheme

github1

  • nord colorscheme

github2

{{$color := 44 -}}
{{if eq .Mode "VISUAL" -}}
  {{$color = 45 -}}
{{end -}}
{{printf "\033[30;%dm %s" $color .Mode}}

{{with .Message -}}
    {{. | printf " \033[0m %s" -}}
{{else with .Stat -}}
    {{.Name | printf " \033[37;40m %s " -}}
    {{with .Target}} -> {{.}}{{end -}}
{{end -}}

{{.SPACER -}}

{{with .Stat -}}
    {{.Size | humanize | printf "\033[34;40m %5s" -}}
    {{.ModTime | printf " \033[37;40m %s" -}}
    {{.Extension | printf "\033[37;40m %s " -}}
{{end -}}

{{with .Keys}} {{.}} {{end -}}
{{with .Progress}} {{join . " " | printf " 󰪹 %s"}}{{end -}}
{{with .Copy}} {{len . | printf "%s %d 󰆏  \033[0m" $.Options.copyfmt}}{{end -}}
{{with .Cut}} {{len . | printf "%s %d 󰆐  \033[0m" $.Options.cutfmt}}{{end -}}
{{with .Select}} {{len . | printf "%s %d 󰒉  \033[0m" $.Options.selectfmt}}{{end -}}
{{with .Visual}} {{len . | printf "%s %d \033[0m" $.Options.visualfmt}}{{end -}}
{{with .Filter}} {{join . " " | printf "\033[7;34m 󰈲 %s \033[0m"}}{{end -}}

{{.ScrollPercentage | printf "\033[34;100m %s " -}}

{{$color := 44 -}}
{{if eq .Mode "VISUAL" -}}
  {{$color = 45 -}}
{{end -}}
{{printf "\033[30;%dm %d/%d " $color .Index .Total}}

Clone this wiki locally