Ruler - gokcehan/lf GitHub Wiki
The ruler (statusbar) at the bottom can be customized using the ruler config file. The file is a Go template and follows its syntax. More details about the syntax can be found in the documentation.
[!IMPORTANT] This feature is currently experimental, and must be enabled using
set rulerfile true.
Examples
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}}
Display options
hidden={{.Options.hidden}}
Display user options
[!NOTE]
Addset user_foo barto thelfrcfile.
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 -}}
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