Files
lf/lf.1
T
valoq 452e073836 fix!: change fallback socket location to a user-specific directory (#2532)
* fix: enforce correct owner of socket

* improve socket handling

* simplify socket name
2026-04-26 00:07:02 +10:00

2623 lines
96 KiB
Groff
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
.\" Automatically generated by Pandoc 3.7.0.2
.\"
.TH "LF" "1" "2026\-04\-08" "r42" "DOCUMENTATION"
.SH NAME
lf \- terminal file manager
.SH SYNOPSIS
\f[B]lf\f[R] [\f[B]\-command\f[R] \f[I]command\f[R]] [\f[B]\-config\f[R]
\f[I]path\f[R]] [\f[B]\-cpuprofile\f[R] \f[I]path\f[R]]
[\f[B]\-doc\f[R]] [\f[B]\-help\f[R]] [\f[B]\-last\-dir\-path\f[R]
\f[I]path\f[R]] [\f[B]\-log\f[R] \f[I]path\f[R]] [\f[B]\-memprofile\f[R]
\f[I]path\f[R]] [\f[B]\-print\-last\-dir\f[R]]
[\f[B]\-print\-selection\f[R]] [\f[B]\-remote\f[R] \f[I]command\f[R]]
[\f[B]\-selection\-path\f[R] \f[I]path\f[R]] [\f[B]\-server\f[R]]
[\f[B]\-single\f[R]] [\f[B]\-version\f[R]]
[\f[I]cd\-or\-select\-path\f[R]]
.SH DESCRIPTION
lf is a terminal file manager.
.PP
The source code can be found in the repository at \c
.UR https://github.com/gokcehan/lf
.UE \c
.PP
This documentation can either be read from the terminal using
\f[CR]lf \-doc\f[R] or online at \c
.UR https://github.com/gokcehan/lf/blob/master/doc.md
.UE \c
\ You can also use the \f[CR]help\f[R] command (default
\f[CR]<f\-1>\f[R]) inside lf to view the documentation in a pager.
A man page with the same content is also available in the repository at
\c
.UR https://github.com/gokcehan/lf/blob/master/lf.1
.UE \c
.SH OPTIONS
.SS POSITIONAL ARGUMENTS
.TP
\f[B]cd\-or\-select\-path\f[R]
Set the starting location.
If \f[I]path\f[R] is a directory, start in there.
If it\(aqs a file, start in the file\(aqs parent directory and select
the file.
When no \f[I]path\f[R] is supplied, lf uses the current directory.
Only accepts one argument.
.SS META OPTIONS
.TP
\f[B]\-doc\f[R]
Show lf\(aqs documentation (same content as this file) and exit.
.TP
\f[B]\-help\f[R]
Show command\-line usage and exit.
.TP
\f[B]\-version\f[R]
Show version information and exit.
.SS STARTUP & CONFIGURATION
.TP
\f[B]\-command\f[R] \f[I]command\f[R]
Execute \f[I]command\f[R] during client initialization (i.e.
after reading configuration, before \f[CR]on\-init\f[R]).
To execute more than one command, you can either use the
\f[B]\-command\f[R] flag multiple times or pass multiple commands at
once by chaining them with \(dq;\(dq.
.TP
\f[B]\-config\f[R] \f[I]path\f[R]
Use the config file at \f[I]path\f[R] instead of the normal search
locations.
This only affects which \f[CR]lfrc\f[R] is read at startup.
.SS SHELL INTEGRATION
.TP
\f[B]\-print\-last\-dir\f[R]
Print the last directory to stdout when lf exits.
This can be used to let lf change your shells working directory.
See \f[CR]CHANGING DIRECTORY\f[R] for more details.
.TP
\f[B]\-last\-dir\-path\f[R] \f[I]path\f[R]
Same as \f[B]\-print\-last\-dir\f[R], but write the directory to
\f[I]path\f[R] instead of stdout.
.TP
\f[B]\-print\-selection\f[R]
Print selected files to stdout when opening a file in lf.
This can be used to use lf as an \(dqopen file\(dq dialog.
First, select the files you want to pass to another program.
Then, confirm the selection by opening a file.
This causes lf to quit and print out the selection.
Quitting lf prematurely discards the selection.
.TP
\f[B]\-selection\-path\f[R] \f[I]path\f[R]
Same as \f[B]\-print\-selection\f[R], but write the newline\-separated
list to \f[I]path\f[R] instead of stdout.
.SS SERVER
.TP
\f[B]\-remote\f[R] \f[I]command\f[R]
Send \f[I]command\f[R] to the running server (i.e.
\f[CR]send\f[R], \f[CR]query\f[R], \f[CR]list\f[R], \f[CR]quit\f[R], or
\f[CR]quit!\f[R]).
See \f[CR]REMOTE COMMANDS\f[R] for more details.
.TP
\f[B]\-server\f[R]
Start the (headless) server process explicitly.
Runs in the foreground and writes server logs to stderr (or the file set
with \f[B]\-log\f[R]).
Clients auto\-start a server if none is running unless
\f[B]\-single\f[R] is used.
.TP
\f[B]\-single\f[R]
Start a stand\-alone client without a server.
Disables remote control.
.SS DIAGNOSTICS
.TP
\f[B]\-log\f[R] \f[I]path\f[R]
Append runtime log messages to \f[I]path\f[R].
.TP
\f[B]\-cpuprofile\f[R] \f[I]path\f[R]
Write a CPU profile to \f[I]path\f[R].
The profile can be used by \f[CR]go tool pprof\f[R].
.TP
\f[B]\-memprofile\f[R] \f[I]path\f[R]
Write a memory profile to \f[I]path\f[R].
The profile can be used by \f[CR]go tool pprof\f[R].
.SS EXAMPLES
Use \f[CR]lf\f[R] to select files (while hiding certain file types):
.IP
.EX
lf \-command \(aqset nohidden\(aq \-command \(aqset hiddenfiles \(dq*mp4:*pdf:*txt\(dq\(aq \-print\-selection
.EE
.PP
Another sophisticated \(dqopen file\(dq dialog focusing on design:
.IP
.EX
lf \-command \(aqset nopreview; set ratios 1; set drawbox; set promptfmt \(dqSelect files [%w] %S q: cancel, l: confirm\(dq\(aq \-print\-selection
.EE
.PP
Open Downloads and set \f[CR]sortby\f[R] and \f[CR]info\f[R] to creation
date:
.IP
.EX
lf \-command \(aqset sortby btime; set info btime\(aq \(ti/Downloads
.EE
.PP
Temporarily prevent \f[CR]lf\f[R] from modifying the command history:
.IP
.EX
lf \-command \(aqset nohistory\(aq
.EE
.PP
Use default settings and log current session:
.IP
.EX
lf \-config /dev/null \-log /tmp/lf.log
.EE
.PP
Force\-quit the server:
.IP
.EX
lf \-remote \(aqquit!\(aq
.EE
.PP
Inherit lf\(aqs working directory in your shell:
.IP
.EX
cd \(dq$(lf \-print\-last\-dir)\(dq
.EE
.SH QUICK REFERENCE
The following commands are provided by lf:
.IP
.EX
quit (default \(aqq\(aq)
up (default \(aqk\(aq and \(aq<up>\(aq)
half\-up (default \(aq<c\-u>\(aq)
page\-up (default \(aq<c\-b>\(aq and \(aq<pgup>\(aq)
scroll\-up (default \(aq<c\-y>\(aq)
down (default \(aqj\(aq and \(aq<down>\(aq)
half\-down (default \(aq<c\-d>\(aq)
page\-down (default \(aq<c\-f>\(aq and \(aq<pgdn>\(aq)
scroll\-down (default \(aq<c\-e>\(aq)
updir (default \(aqh\(aq and \(aq<left>\(aq)
open (default \(aql\(aq and \(aq<right>\(aq)
jump\-next (default \(aq]\(aq)
jump\-prev (default \(aq[\(aq)
top (default \(aqgg\(aq and \(aq<home>\(aq)
bottom (default \(aqG\(aq and \(aq<end>\(aq)
high (default \(aqH\(aq)
middle (default \(aqM\(aq)
low (default \(aqL\(aq)
toggle
invert (default \(aqv\(aq)
unselect (default \(aqu\(aq)
glob\-select
glob\-unselect
copy (default \(aqy\(aq)
cut (default \(aqd\(aq)
paste (default \(aqp\(aq)
clear (default \(aqc\(aq)
sync
draw
redraw (default \(aq<c\-l>\(aq)
load
reload (default \(aq<c\-r>\(aq)
delete (modal)
rename (modal) (default \(aqr\(aq)
read (modal) (default \(aq:\(aq)
shell (modal) (default \(aq$\(aq)
shell\-pipe (modal) (default \(aq%\(aq)
shell\-wait (modal) (default \(aq!\(aq)
shell\-async (modal) (default \(aq&\(aq)
find (modal) (default \(aqf\(aq)
find\-back (modal) (default \(aqF\(aq)
find\-next (default \(aq;\(aq)
find\-prev (default \(aq,\(aq)
search (modal) (default \(aq/\(aq)
search\-back (modal) (default \(aq?\(aq)
search\-next (default \(aqn\(aq)
search\-prev (default \(aqN\(aq)
filter (modal)
setfilter
mark\-save (modal) (default \(aqm\(aq)
mark\-load (modal) (default \(dq\(aq\(dq)
mark\-remove (modal) (default \(aq\(dq\(aq)
tag
tag\-toggle (default \(aqt\(aq)
echo
echomsg
echoerr
cd
select
source
push
addcustominfo
calcdirsize
clearmaps
tty\-write
visual (default \(aqV\(aq)
.EE
.PP
The following Visual mode commands are provided by lf:
.IP
.EX
visual\-accept (default \(aqV\(aq)
visual\-unselect
visual\-discard (default \(aq<esc>\(aq)
visual\-change (default \(aqo\(aq)
.EE
.PP
The following Command\-line mode commands are provided by lf:
.IP
.EX
cmd\-insert
cmd\-escape (default \(aq<esc>\(aq)
cmd\-complete (default \(aq<tab>\(aq)
cmd\-menu\-complete
cmd\-menu\-complete\-back
cmd\-menu\-accept
cmd\-menu\-discard
cmd\-enter (default \(aq<c\-j>\(aq and \(aq<enter>\(aq)
cmd\-interrupt (default \(aq<c\-c>\(aq)
cmd\-history\-next (default \(aq<c\-n>\(aq and \(aq<down>\(aq)
cmd\-history\-prev (default \(aq<c\-p>\(aq and \(aq<up>\(aq)
cmd\-left (default \(aq<c\-b>\(aq and \(aq<left>\(aq)
cmd\-right (default \(aq<c\-f>\(aq and \(aq<right>\(aq)
cmd\-home (default \(aq<c\-a>\(aq and \(aq<home>\(aq)
cmd\-end (default \(aq<c\-e>\(aq and \(aq<end>\(aq)
cmd\-delete (default \(aq<c\-d>\(aq and \(aq<delete>\(aq)
cmd\-delete\-back (default \(aq<backspace>\(aq)
cmd\-delete\-home (default \(aq<c\-u>\(aq)
cmd\-delete\-end (default \(aq<c\-k>\(aq)
cmd\-delete\-unix\-word (default \(aq<c\-w>\(aq)
cmd\-yank (default \(aq<c\-y>\(aq)
cmd\-transpose (default \(aq<c\-t>\(aq)
cmd\-transpose\-word (default \(aq<a\-t>\(aq)
cmd\-word (default \(aq<a\-f>\(aq)
cmd\-word\-back (default \(aq<a\-b>\(aq)
cmd\-delete\-word (default \(aq<a\-d>\(aq)
cmd\-delete\-word\-back (default \(aq<a\-backspace>\(aq)
cmd\-capitalize\-word (default \(aq<a\-c>\(aq)
cmd\-uppercase\-word (default \(aq<a\-u>\(aq)
cmd\-lowercase\-word (default \(aq<a\-l>\(aq)
.EE
.PP
The following options can be used to customize the behavior of lf:
.IP
.EX
anchorfind bool (default true)
autoquit bool (default true)
borderfmt string (default \(dq\(rs033[0m\(dq)
borderstyle string (default \(aqbox\(aq)
cleaner string (default \(aq\(aq)
copyfmt string (default \(dq\(rs033[7;33m\(dq)
cursoractivefmt string (default \(dq\(rs033[7m\(dq)
cursorparentfmt string (default \(dq\(rs033[7m\(dq)
cursorpreviewfmt string (default \(dq\(rs033[4m\(dq)
cutfmt string (default \(dq\(rs033[7;31m\(dq)
dircounts bool (default false)
dirfirst bool (default true)
dironly bool (default false)
dirpreviews bool (default false)
drawbox bool (default false)
dupfilefmt string (default \(aq%f.\(ti%n\(ti\(aq)
errorfmt string (default \(dq\(rs033[7;31;47m\(dq)
filesep string (default \(dq\(rsn\(dq)
filtermethod string (default \(aqtext\(aq)
findlen int (default 1)
hidden bool (default false)
hiddenfiles []string (default \(aq.*\(aq for Unix and \(aq\(aq for Windows)
history bool (default true)
icons bool (default false)
ifs string (default \(aq\(aq)
ignorecase bool (default true)
ignoredia bool (default true)
incfilter bool (default false)
incsearch bool (default false)
info []string (default \(aq\(aq)
infotimefmtnew string (default \(aqJan _2 15:04\(aq)
infotimefmtold string (default \(aqJan _2 2006\(aq)
menufmt string (default \(dq\(rs033[0m\(dq)
menuheaderfmt string (default \(dq\(rs033[1m\(dq)
menuselectfmt string (default \(dq\(rs033[7m\(dq)
mergeindicators bool (default false)
mouse bool (default false)
number bool (default false)
numbercursorfmt string (default \(aq\(aq)
numberfmt string (default \(dq\(rs033[33m\(dq)
period int (default 0)
preload bool (default false)
preserve []string (default \(dqmode\(dq)
preview bool (default true)
previewer string (default \(aq\(aq)
promptfmt string (default \(dq\(rs033[32;1m%u\(at%h\(rs033[0m:\(rs033[34;1m%d\(rs033[0m\(rs033[1m%f\(rs033[0m\(dq)
ratios []int (default \(aq1:2:3\(aq)
relativenumber bool (default false)
reverse bool (default false)
rulerfile string (default \(dq\(dq)
rulerfmt string (default \(dq\(dq)
scrolloff int (default 0)
searchmethod string (default \(aqtext\(aq)
selectfmt string (default \(dq\(rs033[7;35m\(dq)
selmode string (default \(aqall\(aq)
shell string (default \(aqsh\(aq for Unix and \(aqcmd\(aq for Windows)
shellflag string (default \(aq\-c\(aq for Unix and \(aq/c\(aq for Windows)
shellopts []string (default \(aq\(aq)
showbinds bool (default true)
sizeunits string (default \(aqbinary\(aq)
smartcase bool (default true)
smartdia bool (default false)
sortby string (default \(aqnatural\(aq)
statfmt string (default \(dq\(rs033[36m%p\(rs033[0m| %c| %u| %g| %S| %t| \-> %l\(dq)
tabstop int (default 8)
tagfmt string (default \(dq\(rs033[31m\(dq)
tempmarks string (default \(aq\(aq)
terminalcursor string (default \(aqdefault\(aq)
timefmt string (default \(aqMon Jan _2 15:04:05 2006\(aq)
truncatechar string (default \(aq\(ti\(aq)
truncatepct int (default 100)
visualfmt string (default \(dq\(rs033[7;36m\(dq)
waitmsg string (default \(aqPress any key to continue\(aq)
watch bool (default false)
wrapscan bool (default true)
wrapscroll bool (default false)
user_{option} string (default none)
.EE
.PP
The following environment variables are exported for shell commands:
.IP
.EX
f
fs
fv
fx
id
PWD
OLDPWD
LF_LEVEL
OPENER
VISUAL
EDITOR
PAGER
SHELL
lf
lf_{option}
lf_user_{option}
lf_flag_{flag}
lf_width
lf_height
lf_count
lf_mode
.EE
.PP
The following special shell commands are used to customize the behavior
of lf when defined:
.IP
.EX
open
paste
rename
delete
pre\-cd
on\-cd
on\-load
on\-focus\-gained
on\-focus\-lost
on\-init
on\-select
on\-redraw
on\-quit
.EE
.PP
The following commands/keybindings are provided by default:
.IP
.EX
Unix
cmd open &$OPENER \(dq$f\(dq
map e $$EDITOR \(dq$f\(dq
map i $$PAGER \(dq$f\(dq
map w $$SHELL
cmd help $$lf \-doc | $PAGER
map <f\-1> help
cmd maps $lf \-remote \(dqquery $id maps\(dq | $PAGER
cmd nmaps $lf \-remote \(dqquery $id nmaps\(dq | $PAGER
cmd vmaps $lf \-remote \(dqquery $id vmaps\(dq | $PAGER
cmd cmaps $lf \-remote \(dqquery $id cmaps\(dq | $PAGER
cmd cmds $lf \-remote \(dqquery $id cmds\(dq | $PAGER
Windows
cmd open &%OPENER% %f%
map e $%EDITOR% %f%
map i !%PAGER% %f%
map w $%SHELL%
cmd help !%lf% \-doc | %PAGER%
map <f\-1> help
cmd maps !%lf% \-remote \(dqquery %id% maps\(dq | %PAGER%
cmd nmaps !%lf% \-remote \(dqquery %id% nmaps\(dq | %PAGER%
cmd vmaps !%lf% \-remote \(dqquery %id% vmaps\(dq | %PAGER%
cmd cmaps !%lf% \-remote \(dqquery %id% cmaps\(dq | %PAGER%
cmd cmds !%lf% \-remote \(dqquery %id% cmds\(dq | %PAGER%
.EE
.PP
The defaults for Windows are using \f[CR]cmd\f[R] syntax.
A \f[CR]PowerShell\f[R] compatible configuration file can be found at \c
.UR https://github.com/gokcehan/lf/blob/master/etc/lfrc.ps1.example
.UE \c
.PP
The following additional keybindings are provided by default:
.IP
.EX
map zh set hidden!
map zr set reverse!
map zn set info
map zs set info size
map zt set info time
map za set info size:time
map sn :set sortby natural; set info
map ss :set sortby size; set info size
map st :set sortby time; set info time
map sa :set sortby atime; set info atime
map sb :set sortby btime; set info btime
map sc :set sortby ctime; set info ctime
map se :set sortby ext; set info
map gh cd \(ti
nmap <space> :toggle; down
.EE
.PP
If the \f[CR]mouse\f[R] option is enabled, mouse buttons have the
following default effects:
.IP
.EX
Left mouse button
Click on a file or directory to select it.
Right mouse button
Enter a directory or open a file. Also works on the preview pane.
Scroll wheel
Move up or down. If Ctrl is pressed, scroll up or down.
.EE
.SH CONFIGURATION
Configuration files should be located at:
.IP
.EX
OS system\-wide user\-specific
Unix /etc/lf/lfrc \(ti/.config/lf/lfrc
Windows C:\(rsProgramData\(rslf\(rslfrc C:\(rsUsers\(rs<user>\(rsAppData\(rsRoaming\(rslf\(rslfrc
.EE
.PP
The colors file should be located at:
.IP
.EX
OS system\-wide user\-specific
Unix /etc/lf/colors \(ti/.config/lf/colors
Windows C:\(rsProgramData\(rslf\(rscolors C:\(rsUsers\(rs<user>\(rsAppData\(rsRoaming\(rslf\(rscolors
.EE
.PP
The icons file should be located at:
.IP
.EX
OS system\-wide user\-specific
Unix /etc/lf/icons \(ti/.config/lf/icons
Windows C:\(rsProgramData\(rslf\(rsicons C:\(rsUsers\(rs<user>\(rsAppData\(rsRoaming\(rslf\(rsicons
.EE
.PP
The selection file should be located at:
.IP
.EX
Unix \(ti/.local/share/lf/files
Windows C:\(rsUsers\(rs<user>\(rsAppData\(rsLocal\(rslf\(rsfiles
.EE
.PP
The marks file should be located at:
.IP
.EX
Unix \(ti/.local/share/lf/marks
Windows C:\(rsUsers\(rs<user>\(rsAppData\(rsLocal\(rslf\(rsmarks
.EE
.PP
The tags file should be located at:
.IP
.EX
Unix \(ti/.local/share/lf/tags
Windows C:\(rsUsers\(rs<user>\(rsAppData\(rsLocal\(rslf\(rstags
.EE
.PP
The history file should be located at:
.IP
.EX
Unix \(ti/.local/share/lf/history
Windows C:\(rsUsers\(rs<user>\(rsAppData\(rsLocal\(rslf\(rshistory
.EE
.PP
You can configure these locations with the following variables given
with their order of precedences and their default values:
.IP
.EX
Unix
$LF_CONFIG_HOME
$XDG_CONFIG_HOME
\(ti/.config
$LF_DATA_HOME
$XDG_DATA_HOME
\(ti/.local/share
Windows
%LF_CONFIG_HOME%
%XDG_CONFIG_HOME%
%APPDATA%
%LF_DATA_HOME%
%XDG_DATA_HOME%
%LOCALAPPDATA%
.EE
.PP
A sample configuration file can be found at \c
.UR https://github.com/gokcehan/lf/blob/master/etc/lfrc.example
.UE \c
.SH COMMANDS
This section shows information about built\-in commands.
Modal commands do not take any arguments, but instead change the
operation mode to read their input conveniently, and so they are meant
to be assigned to keybindings.
.SS quit (default \f[CR]q\f[R])
Quit lf and return to the shell.
.SS up (default \f[CR]k\f[R] and \f[CR]<up>\f[R]), half\-up (default \f[CR]<c\-u>\f[R]), page\-up (default \f[CR]<c\-b>\f[R] and \f[CR]<pgup>\f[R]), scroll\-up (default \f[CR]<c\-y>\f[R]), down (default \f[CR]j\f[R] and \f[CR]<down>\f[R]), half\-down (default \f[CR]<c\-d>\f[R]), page\-down (default \f[CR]<c\-f>\f[R] and \f[CR]<pgdn>\f[R]), scroll\-down (default \f[CR]<c\-e>\f[R])
Move/scroll the current file selection upwards/downwards by one/half a
page/full page.
.SS updir (default \f[CR]h\f[R] and \f[CR]<left>\f[R])
Change the current working directory to the parent directory.
.SS open (default \f[CR]l\f[R] and \f[CR]<right>\f[R])
If the current file is a directory, then change the current directory to
it, otherwise, execute the \f[CR]open\f[R] command.
A default \f[CR]open\f[R] command is provided to call the default system
opener asynchronously with the current file as the argument.
A custom \f[CR]open\f[R] command can be defined to override this
default.
.SS jump\-next (default \f[CR]]\f[R]), jump\-prev (default \f[CR][\f[R])
Change the current working directory to the next/previous jumplist item.
.SS top (default \f[CR]gg\f[R] and \f[CR]<home>\f[R]), bottom (default \f[CR]G\f[R] and \f[CR]<end>\f[R])
Move the current file selection to the top/bottom of the directory.
A count can be specified to move to a specific line, for example, use
\f[CR]3G\f[R] to move to the third line.
.SS high (default \f[CR]H\f[R]), middle (default \f[CR]M\f[R]), low (default \f[CR]L\f[R])
Move the current file selection to the high/middle/low of the screen.
.SS toggle
Toggle the selection of the current file or files given as arguments.
.SS invert (default \f[CR]v\f[R])
Reverse the selection of all files in the current directory (i.e.
\f[CR]toggle\f[R] all files).
Selections in other directories are not affected by this command.
You can define a new command to select all files in the directory by
combining \f[CR]invert\f[R] with \f[CR]unselect\f[R] (i.e.
\f[CR]cmd select\-all :unselect; invert\f[R]), though this will also
remove selections in other directories.
.SS unselect (default \f[CR]u\f[R])
Remove the selection of all files in all directories.
.SS glob\-select, glob\-unselect
Select/unselect files that match the given glob.
.SS copy (default \f[CR]y\f[R])
Save the paths of selected files to the clipboard as files to be copied.
If there are no selected files, the path of the current file is used
instead.
.SS cut (default \f[CR]d\f[R])
Save the paths of selected files to the clipboard as files to be moved.
If there are no selected files, the path of the current file is used
instead.
.SS paste (default \f[CR]p\f[R])
Copy/Move files in the clipboard to the current working directory.
A custom \f[CR]paste\f[R] command can be defined to override this
default.
.SS clear (default \f[CR]c\f[R])
Clear file paths in the clipboard.
.SS sync
Synchronize copied/cut files with the server.
This command is automatically called when required.
.SS draw
Draw the screen.
This command is automatically called when required.
.SS redraw (default \f[CR]<c\-l>\f[R])
Synchronize the terminal and redraw the screen.
.SS load
Load modified files and directories.
This command is automatically called when required.
.SS reload (default \f[CR]<c\-r>\f[R])
Flush the cache and reload all files and directories.
.SS delete (modal)
Remove the current file or selected file(s).
A custom \f[CR]delete\f[R] command can be defined to override this
default.
.SS rename (modal) (default \f[CR]r\f[R])
Rename the current file using the built\-in method.
A custom \f[CR]rename\f[R] command can be defined to override this
default.
.SS read (modal) (default \f[CR]:\f[R])
Read a command to evaluate.
.SS shell (modal) (default \f[CR]$\f[R])
Read a shell command to execute.
.SS shell\-pipe (modal) (default \f[CR]%\f[R])
Read a shell command to execute piping its standard I/O to the bottom
statline.
.SS shell\-wait (modal) (default \f[CR]!\f[R])
Read a shell command to execute and wait for a key press at the end.
.SS shell\-async (modal) (default \f[CR]&\f[R])
Read a shell command to execute asynchronously without standard I/O.
.SS find (modal) (default \f[CR]f\f[R]), find\-back (modal) (default \f[CR]F\f[R]), find\-next (default \f[CR];\f[R]), find\-prev (default \f[CR],\f[R])
Read key(s) to find the appropriate filename match in the
forward/backward direction and jump to the next/previous match.
.SS search (default \f[CR]/\f[R]), search\-back (default \f[CR]?\f[R]), search\-next (default \f[CR]n\f[R]), search\-prev (default \f[CR]N\f[R])
Read a pattern to search for a filename match in the forward/backward
direction and jump to the next/previous match.
.SS filter (modal), setfilter
Command \f[CR]filter\f[R] reads a pattern to filter out and only view
files matching the pattern.
Command \f[CR]setfilter\f[R] does the same but uses an argument to set
the filter immediately.
You can supply an argument to \f[CR]filter\f[R] to use as the starting
prompt.
.SS mark\-save (modal) (default \f[CR]m\f[R])
Save the current directory as a bookmark assigned to the given key.
.SS mark\-load (modal) (default \f[CR]\(aq\f[R])
Change the current directory to the bookmark assigned to the given key.
A special bookmark \f[CR]\(aq\f[R] holds the previous directory after a
\f[CR]mark\-load\f[R], \f[CR]cd\f[R], or \f[CR]select\f[R] command.
.SS mark\-remove (modal) (default \f[CR]\(dq\f[R])
Remove a bookmark assigned to the given key.
.SS tag
Tag a file with \f[CR]*\f[R] or a single\-width character given in the
argument.
You can define a new tag\-clearing command by combining \f[CR]tag\f[R]
with \f[CR]tag\-toggle\f[R] (i.e.
\f[CR]cmd tag\-clear :tag; tag\-toggle\f[R]).
.SS tag\-toggle (default \f[CR]t\f[R])
Tag a file with \f[CR]*\f[R] or a single\-width character given in the
argument if the file is untagged, otherwise remove the tag.
.SS echo
Print the given arguments to the message line at the bottom.
.SS echomsg
Print the given arguments to the message line at the bottom and also to
the log file.
.SS echoerr
Print given arguments to the message line at the bottom as
\f[CR]errorfmt\f[R] and also to the log file.
.SS cd
Change the working directory to the given argument.
.SS select
Change the current file selection to the given argument.
.SS source
Read the configuration file given in the argument.
.SS push
Simulate key pushes given in the argument.
.SS addcustominfo
Update the \f[CR]custom\f[R] info and \f[CR].Stat.CustomInfo\f[R] field
of the given file with the given string.
The info string may contain ANSI escape codes to further customize its
appearance.
If no info is provided, clear the file\(aqs info instead.
.SS calcdirsize
Calculate the total size for each of the selected directories.
Option \f[CR]info\f[R] should include \f[CR]size\f[R] and option
\f[CR]dircounts\f[R] should be disabled to show this size.
If the total size of a directory is not calculated, it will be shown as
\f[CR]\-\f[R].
.SS clearmaps
Remove all keybindings associated with the \f[CR]map\f[R],
\f[CR]nmap\f[R] and \f[CR]vmap\f[R] command.
This command can be used in the config file to remove the default
keybindings.
For safety purposes, \f[CR]:\f[R] is left mapped to the \f[CR]read\f[R]
command, and \f[CR]cmap\f[R] keybindings are retained so that it is
still possible to exit \f[CR]lf\f[R] using \f[CR]:quit\f[R].
.SS tty\-write
Write the given string to the tty.
This is useful for sending escape sequences to the terminal to control
its behavior (e.g.
OSC 0 to set the window title).
Using \f[CR]tty\-write\f[R] is preferred over directly writing to
\f[CR]/dev/tty\f[R] because the latter is not synchronized and can
interfere with drawing the UI.
.SS visual (default \f[CR]V\f[R])
Switch to Visual mode.
If already in Visual mode, discard the visual selection and stay in
Visual mode.
.SH VISUAL MODE COMMANDS
.SS visual\-accept (default \f[CR]V\f[R])
Add the visual selection to the selection list, quit Visual mode and
return to Normal mode.
.SS visual\-unselect
Remove the visual selection from the selection list, quit Visual mode
and return to Normal mode.
.SS visual\-discard (default \f[CR]<esc>\f[R])
Discard the visual selection, quit Visual mode and return to Normal
mode.
.SS visual\-change (default \f[CR]o\f[R])
Go to the other end of the current Visual mode selection.
.SH COMMAND\-LINE MODE COMMANDS
The prompt character specifies which of the several Command\-line modes
you are in.
For example, the \f[CR]read\f[R] command takes you to the \f[CR]:\f[R]
mode.
.PP
When the cursor is at the first character in \f[CR]:\f[R] mode, pressing
one of the keys \f[CR]!\f[R], \f[CR]$\f[R], \f[CR]%\f[R], or
\f[CR]&\f[R] takes you to the corresponding mode.
You can go back with \f[CR]cmd\-delete\-back\f[R]
(\f[CR]<backspace>\f[R] by default).
.PP
The command line commands should be mostly compatible with readline
keybindings.
A character refers to a Unicode code point, a word consists of letters
and digits, and a Unix word consists of any non\-blank characters.
.SS cmd\-insert
Insert the character given in the argument.
This command is automatically called when required.
.SS cmd\-escape (default \f[CR]<esc>\f[R])
Quit Command\-line mode and return to Normal mode.
.SS cmd\-complete (default \f[CR]<tab>\f[R])
Autocomplete the current word.
.SS cmd\-menu\-complete, cmd\-menu\-complete\-back
Autocomplete the current word with the menu selection.
You need to assign keys to these commands (e.g.
\f[CR]cmap <tab> cmd\-menu\-complete; cmap <backtab> cmd\-menu\-complete\-back\f[R]).
You can use the assigned keys to display the menu and then cycle through
completion options.
.SS cmd\-menu\-accept
Accept the currently selected match in menu completion and close the
menu.
.SS cmd\-menu\-discard
Discard the currently selected match in menu completion and close the
menu.
.SS cmd\-enter (default \f[CR]<c\-j>\f[R] and \f[CR]<enter>\f[R])
Execute the current line.
.SS cmd\-interrupt (default \f[CR]<c\-c>\f[R])
Interrupt the current shell\-pipe command and return to the Normal mode.
.SS cmd\-history\-next (default \f[CR]<c\-n>\f[R] and \f[CR]<down>\f[R]), cmd\-history\-prev (default \f[CR]<c\-p>\f[R] and \f[CR]<up>\f[R])
Go to the next/previous entry in the command history.
If part of the command is already typed, then only matching entries will
be considered, and consecutive duplicate entries are skipped.
.SS cmd\-left (default \f[CR]<c\-b>\f[R] and \f[CR]<left>\f[R]), cmd\-right (default \f[CR]<c\-f>\f[R] and \f[CR]<right>\f[R])
Move the cursor to the left/right.
.SS cmd\-home (default \f[CR]<c\-a>\f[R] and \f[CR]<home>\f[R]), cmd\-end (default \f[CR]<c\-e>\f[R] and \f[CR]<end>\f[R])
Move the cursor to the beginning/end of the line.
.SS cmd\-delete (default \f[CR]<c\-d>\f[R] and \f[CR]<delete>\f[R])
Delete the next character.
.SS cmd\-delete\-back (default \f[CR]<backspace>\f[R])
Delete the previous character.
When at the beginning of a prompt, returns either to Normal mode or to
\f[CR]:\f[R] mode.
.SS cmd\-delete\-home (default \f[CR]<c\-u>\f[R]), cmd\-delete\-end (default \f[CR]<c\-k>\f[R])
Delete everything up to the beginning/end of the line.
.SS cmd\-delete\-unix\-word (default \f[CR]<c\-w>\f[R])
Delete the previous Unix word.
.SS cmd\-yank (default \f[CR]<c\-y>\f[R])
Paste the buffer content containing the last deleted item.
.SS cmd\-transpose (default \f[CR]<c\-t>\f[R])
Swap the characters before and after the cursor, then move the cursor
forward.
If there is no character after the cursor, swap the previous two
characters instead.
.SS cmd\-transpose\-word (default \f[CR]<a\-t>\f[R])
Swap the words before and after the cursor, then move the cursor
forward.
If there is no word after the cursor, swap the previous two words
instead.
.SS cmd\-word (default \f[CR]<a\-f>\f[R]), cmd\-word\-back (default \f[CR]<a\-b>\f[R])
Move the cursor by one word in the forward/backward direction.
.SS cmd\-delete\-word (default \f[CR]<a\-d>\f[R])
Delete the next word in the forward direction.
.SS cmd\-delete\-word\-back (default \f[CR]<a\-backspace>\f[R])
Delete the previous word in the backward direction.
.SS cmd\-capitalize\-word (default \f[CR]<a\-c>\f[R]), cmd\-uppercase\-word (default \f[CR]<a\-u>\f[R]), cmd\-lowercase\-word (default \f[CR]<a\-l>\f[R])
Capitalize/uppercase/lowercase the current word and jump to the next
word.
.SH SETTINGS
This section shows information about options to customize the behavior.
Character \f[CR]:\f[R] is used as the separator for list options
\f[CR][]int\f[R] and \f[CR][]string\f[R].
.SS anchorfind (bool) (default true)
When this option is enabled, the find command starts matching patterns
from the beginning of filenames, otherwise, it can match at an arbitrary
position.
.SS autoquit (bool) (default true)
Automatically quit the server when there are no clients left connected.
.SS borderfmt (string) (default \f[CR]\(rs033[0m\f[R])
Format string of border characters.
.SS borderstyle (string) (default \f[CR]box\f[R])
Border style used by \f[CR]drawbox\f[R].
.PP
The following styles are supported:
.IP
.EX
box outline around all panes and separators between them
roundbox like \(gabox\(ga, but with rounded outer corners
outline outline around all panes
roundoutline like \(gaoutline\(ga, but with rounded outer corners
separators separators between panes
.EE
.SS cleaner (string) (default \(ga\(ga) (not called if empty)
Set the path of a cleaner file.
The file should be executable.
This file is called if previewing is enabled, the previewer is set, and
the previously selected file has its preview cache disabled.
The following arguments are passed to the file, (1) current filename,
(2) width, (3) height, (4) horizontal position, (5) vertical position of
preview pane and (6) next filename to be previewed respectively.
Preview cleaning is disabled when the value of this option is left
empty.
.SS copyfmt (string) (default \f[CR]\(rs033[7;33m\f[R])
Format string of the indicator for files to be copied.
.SS cursoractivefmt (string) (default \f[CR]\(rs033[7m\f[R]), cursorparentfmt (string) (default \f[CR]\(rs033[7m\f[R]), cursorpreviewfmt (string) (default \f[CR]\(rs033[4m\f[R])
Format strings for highlighting the cursor.
\f[CR]cursoractivefmt\f[R] applies in the current directory pane,
\f[CR]cursorparentfmt\f[R] applies in panes that show parents of the
current directory, and \f[CR]cursorpreviewfmt\f[R] applies in panes that
preview directories.
.PP
The default is to make the active cursor and the parent directory cursor
inverted.
The preview cursor is underlined.
.PP
Some other possibilities to consider for the preview or parent cursors:
an empty string for no cursor, \f[CR]\(rs033[7;2m\f[R] for dimmed
inverted text (visibility varies by terminal), \f[CR]\(rs033[7;90m\f[R]
for inverted text with grey (aka \(dqbrightblack\(dq) background.
.PP
If the format string contains the characters \f[CR]%s\f[R], it is
interpreted as a format string for \f[CR]fmt.Sprintf\f[R].
Such a string should end with the terminal reset sequence.
For example, \f[CR]\(rs033[4m%s\(rs033[0m\f[R] has the same effect as
\f[CR]\(rs033[4m\f[R].
.SS cutfmt (string) (default \f[CR]\(rs033[7;31m\f[R])
Format string of the indicator for files to be cut.
.SS dircounts (bool) (default false)
When this option is enabled, directory sizes show the number of items
inside instead of the total size of the directory, which needs to be
calculated for each directory using \f[CR]calcdirsize\f[R].
This information needs to be calculated by reading the directory and
counting the items inside.
Therefore, this option is disabled by default for performance reasons.
This option only has an effect when \f[CR]info\f[R] has a
\f[CR]size\f[R] field and the pane is wide enough to show the
information.
999 items are counted per directory at most, and bigger directories are
shown as \f[CR]999+\f[R].
.SS dirfirst (bool) (default true)
Show directories first above regular files.
With \f[CR]dircounts\f[R] enabled, sorting by \f[CR]size\f[R] always
separates directories and files, regardless of \f[CR]dirfirst\f[R].
.SS dironly (bool) (default false)
Show only directories.
.SS dirpreviews (bool) (default false)
If enabled, directories will also be passed to the previewer script.
This allows custom previews for directories.
.SS drawbox (bool) (default false)
Draw borders around panes using box drawing characters.
.SS dupfilefmt (string) (default \f[CR]%f.\(ti%n\(ti\f[R])
Format string of filename when creating duplicate files.
With the default format, copying a file \f[CR]abc.txt\f[R] to the same
directory will result in a duplicate file called
\f[CR]abc.txt.\(ti1\(ti\f[R].
Special expansions are provided, \f[CR]%f\f[R] as the file name,
\f[CR]%b\f[R] for the base name (file name without extension),
\f[CR]%e\f[R] as the extension (including the dot) and \f[CR]%n\f[R] as
the number of duplicates.
.SS errorfmt (string) (default \f[CR]\(rs033[7;31;47m\f[R])
Format string of error messages shown in the bottom message line.
.PP
If the format string contains the characters \f[CR]%s\f[R], it is
interpreted as a format string for \f[CR]fmt.Sprintf\f[R].
Such a string should end with the terminal reset sequence.
For example, \f[CR]\(rs033[4m%s\(rs033[0m\f[R] has the same effect as
\f[CR]\(rs033[4m\f[R].
.SS filesep (string) (default \f[CR]\(rsn\f[R])
File separator used in environment variables \f[CR]fs\f[R],
\f[CR]fv\f[R] and \f[CR]fx\f[R].
.SS filtermethod (string) (default \f[CR]text\f[R])
How filter command patterns are treated.
Currently supported methods are \f[CR]text\f[R] (i.e.
string literals), \f[CR]glob\f[R] (i.e.
shell globs) and \f[CR]regex\f[R] (i.e.
regular expressions).
See \f[CR]SEARCHING FILES\f[R] for more details.
.SS findlen (int) (default 1)
Number of characters prompted for the find command.
When this value is set to 0, find command prompts until there is only a
single match left.
.SS hidden (bool) (default false)
Show hidden files.
On Unix systems, hidden files are determined by the value of
\f[CR]hiddenfiles\f[R].
On Windows, files with hidden attributes are also considered hidden
files.
.SS hiddenfiles ([]string) (default \f[CR].*\f[R] for Unix and \(ga\(ga for Windows)
List of hidden file glob patterns.
Patterns can be given as relative or absolute paths.
Globbing supports the usual special characters, \f[CR]*\f[R] to match
any sequence, \f[CR]?\f[R] to match any character, and \f[CR][...]\f[R]
or \f[CR][\(ha...]\f[R] to match character sets or ranges.
In addition, if a pattern starts with \f[CR]!\f[R], then its matches are
excluded from hidden files.
To add multiple patterns, use \f[CR]:\f[R] as a separator.
Example: \f[CR].*:lost+found:*.bak\f[R]
.SS history (bool) (default true)
Save command history.
.SS icons (bool) (default false)
Show icons before each item in the list.
.SS ifs (string) (default \(ga\(ga)
Sets \f[CR]IFS\f[R] variable in shell commands.
It works by adding the assignment to the beginning of the command string
as \f[CR]IFS=...; ...\f[R].
The reason is that \f[CR]IFS\f[R] variable is not inherited by the shell
for security reasons.
This method assumes a POSIX shell syntax so it can fail for non\-POSIX
shells.
This option has no effect when the value is left empty.
This option does not have any effect on Windows.
.SS ignorecase (bool) (default true)
Ignore case in sorting and search patterns.
.SS ignoredia (bool) (default true)
Ignore diacritics in sorting and search patterns.
.SS incfilter (bool) (default false)
Apply filter pattern after each keystroke during filtering.
.SS incsearch (bool) (default false)
Jump to the first match after each keystroke during searching.
.SS info ([]string) (default \(ga\(ga)
A list of information that is shown for directory items at the right
side of the pane.
.PP
The following information types are supported:
.IP
.EX
perm file permission
user user name
group group name
size file size
time time of last data modification
atime time of last access
btime time of file birth
ctime time of last status (inode) change
custom property defined via \(gaaddcustominfo\(ga (empty by default)
.EE
.PP
Information is only shown when the pane width is more than twice the
width of information.
.SS infotimefmtnew (string) (default \f[CR]Jan _2 15:04\f[R])
Format string of the file time shown in the info column when it matches
this year.
.SS infotimefmtold (string) (default \f[CR]Jan _2 2006\f[R])
Format string of the file time shown in the info column when it
doesn\(aqt match this year.
.SS menufmt (string) (default \f[CR]\(rs033[0m\f[R])
Format string of the menu.
.SS menuheaderfmt (string) (default \f[CR]\(rs033[1m\f[R])
Format string of the header row in the menu.
.SS menuselectfmt (string) (default \f[CR]\(rs033[7m\f[R])
Format string of the currently selected item in the menu.
.SS mergeindicators (bool) (default false)
When \f[CR]mergeindicators\f[R] is enabled, tag and selection indicators
are drawn in a single column to reduce the gap before filenames.
If a file is both tagged and selected, the tag uses the selection format
(e.g.
\f[CR]copyfmt\f[R]) instead of \f[CR]tagfmt\f[R].
.SS mouse (bool) (default false)
Send mouse events as input.
.SS number (bool) (default false)
Show the position number for directory items on the left side of the
pane.
When the \f[CR]relativenumber\f[R] option is enabled, only the current
line shows the absolute position and relative positions are shown for
the rest.
.SS numberfmt (string) (default \f[CR]\(rs033[33m\f[R]), numbercursorfmt (string) (default \(ga\(ga)
Format strings for highlighting line numbers.
\f[CR]numberfmt\f[R] applies to all lines.
\f[CR]numbercursorfmt\f[R] applies to the cursor line and falls back to
\f[CR]numberfmt\f[R] when left empty.
.SS period (int) (default 0)
Set the interval in seconds for periodic checks of directory updates.
This works by periodically calling the \f[CR]load\f[R] command.
Note that directories are already updated automatically in many cases.
This option can be useful when there is an external process changing the
displayed directory and you are not doing anything in lf.
Periodic checks are disabled when the value of this option is set to
zero.
.SS preload (bool) (default false)
Allow previews to be generated in advance using the \f[CR]previewer\f[R]
script as the user navigates through the filesystem.
.SS preserve ([]string) (default \f[CR]mode\f[R])
List of attributes that are preserved when copying files.
Currently supported attributes are \f[CR]mode\f[R] (i.e.
access mode) and \f[CR]timestamps\f[R] (i.e.
modification time and access time).
Note that preserving other attributes like ownership of change/birth
timestamp is desirable, but not portably supported in Go.
.SS preview (bool) (default true)
Show previews of files and directories at the rightmost pane.
If the file has more lines than the preview pane, the rest of the lines
are not read.
Files containing the null character (U+0000) in the read portion are
considered binary files and displayed as \f[CR]binary\f[R].
.SS previewer (string) (default \(ga\(ga) (not filtered if empty)
Set the path of a previewer file to filter the content of regular files
for previewing.
The file should be executable.
The following arguments are passed to the file, (1) current filename,
(2) width, (3) height, (4) horizontal position, (5) vertical position,
and (6) mode (\(dqpreview\(dq or \(dqpreload\(dq).
SIGPIPE signal is sent when enough lines are read.
If the previewer returns a non\-zero exit code, then the preview cache
for the given file is disabled.
This means that if the file is selected in the future, the previewer is
called once again.
Preview filtering is disabled and files are displayed as they are when
the value of this option is left empty.
If the \f[CR]preload\f[R] option is enabled, then this will be called
with \f[CR]preload\f[R] as the mode when preloading file previews.
Refer to the \c
.UR https://github.com/gokcehan/lf/blob/master/doc.md#previewing-files
PREVIEWING FILES section
.UE \c
\ for more information about how to configure custom previews.
.SS promptfmt (string) (default \f[CR]\(rs033[32;1m%u\(at%h\(rs033[0m:\(rs033[34;1m%d\(rs033[0m\(rs033[1m%f\(rs033[0m\f[R])
Format string of the prompt shown in the top line.
.PP
The following special expansions are supported:
.IP
.EX
%f file name
%h host name
%u user name
%w working directory
%d working directory (with trailing path separator)
%F current filter
%S spacer to right\-align the following parts (can be used once)
.EE
.PP
The home folder is shown as \f[CR]\(ti\f[R] 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.
.SS ratios ([]int) (default \f[CR]1:2:3\f[R])
List of ratios of pane widths.
Number of items in the list determines the number of panes in the UI.
When the \f[CR]preview\f[R] option is enabled, the rightmost number is
used for the width of the preview pane.
.SS relativenumber (bool) (default false)
Show the position number relative to the current line.
When \f[CR]number\f[R] is enabled, the current line shows the absolute
position, otherwise nothing is shown.
.SS reverse (bool) (default false)
Reverse the direction of sort.
.SS rulerfile (string) (default \(ga\(ga)
Set the path of the ruler file.
If not set, then a default template will be used for the ruler.
Refer to the \c
.UR https://github.com/gokcehan/lf/blob/master/doc.md#ruler
RULER section
.UE \c
\ for more information about how the ruler file works.
.SS rulerfmt (string) (default \(ga\(ga)
Format string of the ruler shown in the bottom right corner.
When set, it will be used along with \f[CR]statfmt\f[R] to draw the
ruler, and \f[CR]rulerfile\f[R] will be ignored.
However, using \f[CR]rulerfile\f[R] is preferred and this option is
provided for backwards compatibility.
.PP
The following special expansions are supported:
.IP
.EX
%a pressed keys
%p progress of file operations
%m number of files to be cut (moved)
%c number of files to be copied
%s number of selected files
%v number of visually selected files
%t number of shown files in the current directory
%h number of hidden files in the current directory
%f current filter
%i cursor position
%P scroll percentage
%d amount of free disk space
.EE
.PP
Additional expansions are provided for environment variables exported by
lf, in the form \f[CR]%{lf_<name>}\f[R] (e.g.
\f[CR]%{lf_selmode}\f[R]).
This is useful for displaying the current settings.
Expansions are also provided for user\-defined options, in the form
\f[CR]%{lf_user_<name>}\f[R] (e.g.
\f[CR]%{lf_user_foo}\f[R]).
The \f[CR]|\f[R] character splits the format string into sections.
Any section containing a failed expansion (result is a blank string) is
discarded and not shown.
.SS scrolloff (int) (default 0)
Minimum number of offset lines shown at all times at the top and bottom
of the screen when scrolling.
The current line is kept in the middle when this option is set to a
large value that is bigger than half the number of lines.
A smaller offset can be used when the current file is close to the
beginning or end of the list to show the maximum number of items.
.SS searchmethod (string) (default \f[CR]text\f[R])
How search command patterns are treated.
Currently supported methods are \f[CR]text\f[R] (i.e.
string literals), \f[CR]glob\f[R] (i.e.
shell globs) and \f[CR]regex\f[R] (i.e.
regular expressions).
See \f[CR]SEARCHING FILES\f[R] for more details.
.SS selectfmt (string) (default \f[CR]\(rs033[7;35m\f[R])
Format string of the indicator for files that are selected.
.SS selmode (string) (default \f[CR]all\f[R])
Selection mode for commands.
When set to \f[CR]all\f[R] it will use the selected files from all
directories.
When set to \f[CR]dir\f[R] it will only use the selected files in the
current directory.
.SS shell (string) (default \f[CR]sh\f[R] for Unix and \f[CR]cmd\f[R] for Windows)
Shell executable to use for shell commands.
Shell commands are executed as
\f[CR]shell shellopts shellflag command \-\- arguments\f[R].
.SS shellflag (string) (default \f[CR]\-c\f[R] for Unix and \f[CR]/c\f[R] for Windows)
Command line flag used to pass shell commands.
.SS shellopts ([]string) (default \(ga\(ga)
List of shell options to pass to the shell executable.
.SS showbinds (bool) (default true)
Show bindings associated with pressed keys.
.SS sizeunits (string) (default \f[CR]binary\f[R])
Determines whether file sizes are displayed using binary units
(\f[CR]1K\f[R] is 1024 bytes) or decimal units (\f[CR]1K\f[R] is 1000
bytes).
.SS smartcase (bool) (default true)
Override \f[CR]ignorecase\f[R] option when the pattern contains an
uppercase character.
This option has no effect when \f[CR]ignorecase\f[R] is disabled.
.SS smartdia (bool) (default false)
Override \f[CR]ignoredia\f[R] option when the pattern contains a
character with diacritic.
This option has no effect when \f[CR]ignoredia\f[R] is disabled.
.SS sortby (string) (default \f[CR]natural\f[R])
Sort type for directories.
.PP
The following sort types are supported:
.IP
.EX
natural file name (track_2.flac comes before track_10.flac)
name file name (track_10.flac comes before track_2.flac)
ext file extension
size file size
time time of last data modification
atime time of last access
btime time of file birth
ctime time of last status (inode) change
custom property defined via \(gaaddcustominfo\(ga (empty by default)
.EE
.SS statfmt (string) (default \f[CR]\(rs033[36m%p\(rs033[0m| %c| %u| %g| %S| %t| \-> %l\f[R])
Format string of the file info shown in the bottom left corner.
This option has no effect unless \f[CR]rulerfmt\f[R] is also set.
Using \f[CR]rulerfile\f[R] is preferred and this option is provided for
backwards compatibility.
.PP
The following special expansions are supported:
.IP
.EX
%p file permission
%c link count
%u user name
%g group name
%s file size
%S file size (left\-padded with spaces to a fixed width of 5 characters)
%t time of last data modification
%l link target
%m current mode
%M current mode (displaying \(gaNORMAL\(ga instead of a blank string in Normal mode)
.EE
.PP
The \f[CR]|\f[R] character splits the format string into sections.
Any section containing a failed expansion (result is a blank string) is
discarded and not shown.
.SS tabstop (int) (default 8)
Number of space characters to show for horizontal tabulation (U+0009)
character.
.SS tagfmt (string) (default \f[CR]\(rs033[31m\f[R])
Format string of the tags.
.PP
If the format string contains the characters \f[CR]%s\f[R], it is
interpreted as a format string for \f[CR]fmt.Sprintf\f[R].
Such a string should end with the terminal reset sequence.
For example, \f[CR]\(rs033[4m%s\(rs033[0m\f[R] has the same effect as
\f[CR]\(rs033[4m\f[R].
.SS tempmarks (string) (default \(ga\(ga)
Marks to be considered temporary (e.g.
\f[CR]abc\f[R] refers to marks \f[CR]a\f[R], \f[CR]b\f[R], and
\f[CR]c\f[R]).
These marks are not synced to other clients and they are not saved in
the bookmarks file.
Note that the special bookmark \f[CR]\(aq\f[R] is always treated as
temporary and it does not need to be specified.
.SS terminalcursor (string) (default \f[CR]default\f[R])
Set the appearance of the terminal cursor for prompts shown in the
bottom line.
Currently supported values are \f[CR]default\f[R], \f[CR]block\f[R],
\f[CR]underline\f[R], \f[CR]bar\f[R], \f[CR]blinkblock\f[R],
\f[CR]blinkunderline\f[R] and \f[CR]blinkbar\f[R].
.SS timefmt (string) (default \f[CR]Mon Jan _2 15:04:05 2006\f[R])
Format string of the file modification time shown in the bottom line.
.SS truncatechar (string) (default \f[CR]\(ti\f[R])
The truncate character that is shown at the end when the filename does
not fit into the pane.
.SS truncatepct (int) (default 100)
When a filename is too long to be shown completely, the available space
will be partitioned into two parts.
\f[CR]truncatepct\f[R] is a percentage value between 0 and 100 that
determines the size of the first part, which will be shown at the
beginning of the filename.
The second part uses the rest of the available space, and will be shown
at the end of the filename.
Both parts are separated by the truncation character
(\f[CR]truncatechar\f[R]).
Truncation is not applied to the file extension.
.PP
For example, with the filename \f[CR]very_long_filename.txt\f[R]:
.IP \(bu 2
\f[CR]set truncatepct 100\f[R] \-> \f[CR]very_long_filena\(ti.txt\f[R]
(default)
.IP \(bu 2
\f[CR]set truncatepct 50\f[R] \-> \f[CR]very_lon\(tifilename.txt\f[R]
.IP \(bu 2
\f[CR]set truncatepct 0\f[R] \-> \f[CR]\(tiry_long_filename.txt\f[R]
.SS visualfmt (string) (default \f[CR]\(rs033[7;36m\f[R])
Format string of the indicator for files that are visually selected.
.SS waitmsg (string) (default \f[CR]Press any key to continue\f[R])
String shown after commands of shell\-wait type.
.SS watch (bool) (default false)
Watch the filesystem for changes using \f[CR]fsnotify\f[R] to
automatically refresh file information.
FUSE is currently not supported due to limitations in
\f[CR]fsnotify\f[R].
.SS wrapscan (bool) (default true)
Searching can wrap around the file list.
.SS wrapscroll (bool) (default false)
Scrolling can wrap around the file list.
.SS user_{option} (string) (default none)
Any option that is prefixed with \f[CR]user_\f[R] is a user\-defined
option and can be set to any string.
Inside a user\-defined command, the value will be provided in the
\f[CR]lf_user_{option}\f[R] environment variable.
These options are not used by lf and are not persisted.
.SH ENVIRONMENT VARIABLES
The following variables are exported for shell commands: These are
referred to with a \f[CR]$\f[R] prefix on POSIX shells (e.g.
\f[CR]$f\f[R]), between \f[CR]%\f[R] characters on Windows cmd (e.g.
\f[CR]%f%\f[R]), and with a \f[CR]$env:\f[R] prefix on Windows
PowerShell (e.g.
\f[CR]$env:f\f[R]).
.SS f
Current file selection as a full path.
.SS fs
Selected file(s) separated with the value of \f[CR]filesep\f[R] option
as full path(s).
.SS fv
Visually selected file(s) separated with the value of \f[CR]filesep\f[R]
option as full path(s).
.SS fx
Selected file(s) (i.e.
\f[CR]fs\f[R], never \f[CR]fv\f[R]) if there are any selected files,
otherwise current file selection (i.e.
\f[CR]f\f[R]).
.SS id
Id of the running client.
.SS PWD
Present working directory.
.SS OLDPWD
Initial working directory.
.SS LF_LEVEL
The value of this variable is set to the current nesting level when you
run lf from a shell spawned inside lf.
You can add the value of this variable to your shell prompt to make it
clear that your shell runs inside lf.
For example, with POSIX shells, you can use
\f[CR][ \-n \(dq$LF_LEVEL\(dq ] && PS1=\(dq$PS1\(dq\(dq(lf level: $LF_LEVEL) \(dq\f[R]
in your shell configuration file (e.g.
\f[CR]\(ti/.bashrc\f[R]).
.SS OPENER
If this variable is set in the environment, use the same value.
Otherwise, this is set to \f[CR]start\f[R] in Windows, \f[CR]open\f[R]
in macOS, \f[CR]xdg\-open\f[R] in others.
.SS EDITOR
If VISUAL is set in the environment, use its value.
Otherwise, use the value of the environment variable EDITOR.
If neither variable is set, this is set to \f[CR]vi\f[R] on Unix,
\f[CR]notepad\f[R] in Windows.
.SS PAGER
If this variable is set in the environment, use the same value.
Otherwise, this is set to \f[CR]less\f[R] on Unix, \f[CR]more\f[R] in
Windows.
.SS SHELL
If this variable is set in the environment, use the same value.
Otherwise, this is set to \f[CR]sh\f[R] on Unix, \f[CR]cmd\f[R] in
Windows.
.SS lf
Absolute path to the currently running lf binary, if it can be found.
Otherwise, this is set to the string \f[CR]lf\f[R].
.SS lf_{option}
Value of the {option}.
.SS lf_user_{option}
Value of the user_{option}.
.SS lf_flag_{flag}
Value of the command line {flag}.
.SS lf_width, lf_height
Width/Height of the terminal.
.SS lf_count
Value of the count associated with the current command.
.SS lf_mode
Current mode that \f[CR]lf\f[R] is operating in.
This is useful for customizing keybindings depending on what the current
mode is.
Possible values are \f[CR]compmenu\f[R], \f[CR]delete\f[R],
\f[CR]rename\f[R], \f[CR]filter\f[R], \f[CR]find\f[R], \f[CR]mark\f[R],
\f[CR]search\f[R], \f[CR]command\f[R], \f[CR]shell\f[R], \f[CR]pipe\f[R]
(when running a shell\-pipe command), \f[CR]normal\f[R],
\f[CR]visual\f[R] and \f[CR]unknown\f[R].
.SH SPECIAL COMMANDS
This section shows information about special shell commands.
.SS open
This shell command can be defined to override the default
\f[CR]open\f[R] command when the current file is not a directory.
.SS paste
This shell command can be defined to override the default
\f[CR]paste\f[R] command.
.SS rename
This shell command can be defined to override the default
\f[CR]rename\f[R] command.
.SS delete
This shell command can be defined to override the default
\f[CR]delete\f[R] command.
.SS pre\-cd
This shell command can be defined to be executed before changing a
directory.
.SS on\-cd
This shell command can be defined to be executed after changing a
directory.
.SS on\-load
This shell command can be defined to be executed after loading a
directory.
It provides the files inside the directory as arguments.
.SS on\-focus\-gained
This shell command can be defined to be executed when the terminal gains
focus.
.SS on\-focus\-lost
This shell command can be defined to be executed when the terminal loses
focus.
.SS on\-init
This shell command can be defined to be executed after initializing and
connecting to the server.
.SS on\-select
This shell command can be defined to be executed after the selection
changes.
.SS on\-redraw
This shell command can be defined to be executed after the screen is
redrawn or if the terminal is resized.
.SS on\-quit
This shell command can be defined to be executed before quitting.
.SH PREFIXES
The following command prefixes are used by lf:
.IP
.EX
: read (default) built\-in/custom command
$ shell shell command
% shell\-pipe shell command running with the UI
! shell\-wait shell command waiting for a key press
& shell\-async shell command running asynchronously
.EE
.PP
The same evaluator is used for the command line and the configuration
file for reading shell commands.
The difference is that prefixes are not necessary in the command line.
Instead, different modes are provided to read corresponding commands.
These modes are mapped to the prefix keys above by default.
Visual mode mappings are defined the same way Normal mode mappings are
defined.
.SH SYNTAX
Characters from \f[CR]#\f[R] to newline are comments and ignored:
.IP
.EX
# comments start with \(ga#\(ga
.EE
.PP
The following commands (\f[CR]set\f[R], \f[CR]setlocal\f[R],
\f[CR]map\f[R], \f[CR]nmap\f[R], \f[CR]vmap\f[R], \f[CR]cmap\f[R], and
\f[CR]cmd\f[R]) are used for configuration.
.PP
Command \f[CR]set\f[R] is used to set an option which can be a boolean,
integer, or string:
.IP
.EX
set hidden # boolean enable
set hidden true # boolean enable
set nohidden # boolean disable
set hidden false # boolean disable
set hidden! # boolean toggle
set scrolloff 10 # integer value
set sortby time # string value without quotes
set sortby \(aqtime\(aq # string value with single quotes (whitespace)
set sortby \(dqtime\(dq # string value with double quotes (backslash escapes)
.EE
.PP
Command \f[CR]setlocal\f[R] is used to set a local option for a
directory which can be a boolean or string.
Currently supported local options are \f[CR]dircounts\f[R],
\f[CR]dirfirst\f[R], \f[CR]dironly\f[R], \f[CR]hidden\f[R],
\f[CR]info\f[R], \f[CR]reverse\f[R] and \f[CR]sortby\f[R].
.IP
.EX
setlocal /foo/bar hidden # boolean enable
setlocal /foo/bar hidden true # boolean enable
setlocal /foo/bar nohidden # boolean disable
setlocal /foo/bar hidden false # boolean disable
setlocal /foo/bar hidden! # boolean toggle
setlocal /foo/bar sortby time # string value without quotes
setlocal /foo/bar sortby \(aqtime\(aq # string value with single quotes (whitespace)
setlocal /foo/bar sortby \(dqtime\(dq # string value with double quotes (backslash escapes)
.EE
.PP
Command \f[CR]map\f[R] is used to bind a key in Normal and Visual mode
to a command which can be a built\-in command, custom command, or shell
command:
.IP
.EX
map gh cd \(ti # built\-in command
map D trash # custom command
map i $less $f # shell command
map U !du \-csh * # waiting shell command
.EE
.PP
Command \f[CR]nmap\f[R] does the same but for Normal mode only.
.PP
Command \f[CR]vmap\f[R] does the same but for Visual mode only.
.PP
Overview of which map command works in which mode:
.IP
.EX
map Normal, Visual
nmap Normal
vmap Visual
cmap Command\-line
.EE
.PP
Command \f[CR]cmap\f[R] is used to bind a key on the command line to a
command line command or any other command:
.IP
.EX
cmap <c\-g> cmd\-escape
cmap <a\-i> set incsearch!
.EE
.PP
You can delete an existing binding by leaving the expression empty:
.IP
.EX
map gh # deletes \(aqgh\(aq mapping in Normal and Visual mode
nmap v # deletes \(aqv\(aq mapping in Normal mode
vmap o # deletes \(aqo\(aq mapping in Visual mode
cmap <c\-g> # deletes \(aq<c\-g>\(aq mapping
.EE
.PP
Command \f[CR]cmd\f[R] is used to define a custom command:
.IP
.EX
cmd usage $du \-h \-d1 | less
.EE
.PP
You can delete an existing command by leaving the expression empty:
.IP
.EX
cmd trash # deletes \(aqtrash\(aq command
.EE
.PP
If there is no prefix then \f[CR]:\f[R] is assumed:
.IP
.EX
map zt set info time
.EE
.PP
An explicit \f[CR]:\f[R] can be provided to group statements until a
newline which is especially useful for \f[CR]map\f[R] and \f[CR]cmd\f[R]
commands:
.IP
.EX
map st :set sortby time; set info time
.EE
.PP
If you need multiline you can wrap statements in \f[CR]{{\f[R] and
\f[CR]}}\f[R] after the proper prefix.
.IP
.EX
map st :{{
set sortby time
set info time
}}
.EE
.SH KEY MAPPINGS
Regular keys are assigned to a command with the usual syntax:
.IP
.EX
map a down
.EE
.PP
Keys combined with the Shift key simply use the uppercase letter:
.IP
.EX
map A down
.EE
.PP
Special keys are written in between \f[CR]<\f[R] and \f[CR]>\f[R]
characters and always use lowercase letters:
.IP
.EX
map <enter> down
.EE
.PP
Angle brackets can be assigned with their special names:
.IP
.EX
map <lt> down
map <gt> down
.EE
.PP
Function keys are prefixed with an \f[CR]f\f[R] character:
.IP
.EX
map <f\-1> down
.EE
.PP
Keys combined with the Ctrl key are prefixed with a \f[CR]c\f[R]
character:
.IP
.EX
map <c\-a> down
.EE
.PP
Keys combined with the Alt key are assigned in two different ways
depending on the behavior of your terminal.
Older terminals (e.g.
xterm) may set the 8th bit of a character when the Alt key is pressed.
On these terminals, you can use the corresponding byte for the mapping:
.IP
.EX
map á down
.EE
.PP
Newer terminals (e.g.
gnome\-terminal) may prefix the key with an escape character when the
Alt key is pressed.
lf uses the escape delaying mechanism to recognize Alt keys in these
terminals (delay is 100ms).
On these terminals, keys combined with the Alt key are prefixed with an
\f[CR]a\f[R] character:
.IP
.EX
map <a\-a> down
.EE
.PP
It is possible to combine special keys with modifiers:
.IP
.EX
map <a\-enter> down
.EE
.PP
Combining multiple modifiers (e.g.
\f[CR]Ctrl+Shift+Space\f[R]) is not supported.
.PP
Note that lf\(aqs key mapping syntax is similar to Vim\(aqs, but not
identical.
Some special keys and modifiers use different names and separators, and
key names are matched literally (i.e.
no case\-folding, no aliases), so some familiar forms will not work:
.IP
.EX
map <enter> down # not <Enter>, <Return> or <CR>
map <f\-1> down # not <F1>
map <a\-j> down # not <A\-j> or <M\-j> (Meta)
map <m\-2> down # not <RightMouse>
map <m\-up> down # not <ScrollWheelUp>
.EE
.PP
WARNING: Some key combinations will likely be intercepted by your OS,
window manager, or terminal.
Other key combinations may not be distinguishable by lf, depending on
how the terminal reports them (e.g.
\f[CR]Ctrl+h\f[R] may be reported as \f[CR]backspace\f[R] instead).
The easiest way to find out the name of a key combination and whether it
will work on your system is to press the key while lf is running and
read the name from the \f[CR]unknown mapping\f[R] error.
.PP
Mouse buttons are prefixed with an \f[CR]m\f[R] character:
.IP
.EX
map <m\-1> down # primary
map <m\-2> down # secondary
map <m\-3> down # middle
map <m\-4> down # thumb next
map <m\-5> down # thumb prev
map <m\-6> down
map <m\-7> down
map <m\-8> down
.EE
.PP
Mouse wheel events are also prefixed with an \f[CR]m\f[R] character:
.IP
.EX
map <m\-up> down
map <m\-down> down
map <m\-left> down
map <m\-right> down
.EE
.SH PUSH MAPPINGS
The usual way to map a key sequence is to assign it to a named or
unnamed command.
While this provides a clean way to remap built\-in keys as well as other
commands, it can be limiting at times.
For this reason, the \f[CR]push\f[R] command is provided by lf.
This command is used to simulate key pushes given as its arguments.
You can \f[CR]map\f[R] a key to a \f[CR]push\f[R] command with an
argument to create various keybindings.
.PP
This is mainly useful for two purposes.
First, it can be used to map a command with a command count:
.IP
.EX
map <c\-j> push 10j
.EE
.PP
Second, it can be used to avoid typing the name when a command takes
arguments:
.IP
.EX
map r push :rename<space>
.EE
.PP
One thing to be careful of is that since the \f[CR]push\f[R] command
works with keys instead of commands it is possible to accidentally
create recursive bindings:
.IP
.EX
map j push 2j
.EE
.PP
These types of bindings create a deadlock when executed.
.SH SHELL COMMANDS
Regular shell commands are the most basic command type that is useful
for many purposes.
For example, we can write a shell command to move the selected file(s)
to trash.
A first attempt to write such a command may look like this:
.IP
.EX
cmd trash ${{
mkdir \-p \(ti/.trash
if [ \-z \(dq$fs\(dq ]; then
mv \(dq$f\(dq \(ti/.trash
else
IFS=\(dq$(printf \(aq\(rsn\(rst\(aq)\(dq; mv $fs \(ti/.trash
fi
}}
.EE
.PP
We check \f[CR]$fs\f[R] to see if there are any selected files.
Otherwise, we just delete the current file.
Since this is such a common pattern, a separate \f[CR]$fx\f[R] variable
is provided.
We can use this variable to get rid of the conditional:
.IP
.EX
cmd trash ${{
mkdir \-p \(ti/.trash
IFS=\(dq$(printf \(aq\(rsn\(rst\(aq)\(dq; mv $fx \(ti/.trash
}}
.EE
.PP
The trash directory is checked each time the command is executed.
We can move it outside of the command so it would only run once at
startup:
.IP
.EX
${{ mkdir \-p \(ti/.trash }}
cmd trash ${{ IFS=\(dq$(printf \(aq\(rsn\(rst\(aq)\(dq; mv $fx \(ti/.trash }}
.EE
.PP
Since these are one\-liners, we can drop \f[CR]{{\f[R] and
\f[CR]}}\f[R]:
.IP
.EX
$mkdir \-p \(ti/.trash
cmd trash $IFS=\(dq$(printf \(aq\(rsn\(rst\(aq)\(dq; mv $fx \(ti/.trash
.EE
.PP
Finally, note that we set the \f[CR]IFS\f[R] variable manually in these
commands.
Instead, we could use the \f[CR]ifs\f[R] option to set it for all shell
commands (i.e.
\f[CR]set ifs \(dq\(rsn\(dq\f[R]).
This can be especially useful for interactive use (e.g.
\f[CR]$rm $f\f[R] or \f[CR]$rm $fs\f[R] would simply work).
This option is not set by default as it can behave unexpectedly for new
users.
However, use of this option is highly recommended and it is assumed in
the rest of the documentation.
.SH PIPING SHELL COMMANDS
Regular shell commands have some limitations in some cases.
When an output or error message is given and the command exits
afterwards, the UI is immediately resumed and there is no way to see the
message without dropping to shell again.
Also, even when there is no output or error, the UI still needs to be
paused while the command is running.
This can cause flickering on the screen for short commands and similar
distractions for longer commands.
.PP
Instead of pausing the UI, piping shell commands connect stdin, stdout,
and stderr of the command to the statline at the bottom of the UI.
This can be useful for programs following the Unix philosophy to give no
output in the success case, and brief error messages or prompts in other
cases.
.PP
For example, the following rename command prompts for overwrite in the
statline if there is an existing file with the given name:
.IP
.EX
cmd rename %mv \-i $f $1
.EE
.PP
You can also output error messages in the command and they will show up
in the statline.
For example, an alternative rename command may look like this:
.IP
.EX
cmd rename %[ \-e $1 ] && printf \(dqfile exists\(dq || mv $f $1
.EE
.PP
Note that input is line buffered and output and error are byte buffered.
.SH WAITING SHELL COMMANDS
Waiting shell commands are similar to regular shell commands except that
they wait for a key press when the command is finished.
These can be useful to see the output of a program before the UI is
resumed.
Waiting shell commands are more appropriate than piping shell commands
when the command is verbose and the output is best displayed as
multiline.
.SH ASYNCHRONOUS SHELL COMMANDS
Asynchronous shell commands are used to start a command in the
background and then resume operation without waiting for the command to
finish.
Stdin, stdout, and stderr of the command are neither connected to the
terminal nor the UI.
.SH REMOTE COMMANDS
One of the more advanced features in lf is remote commands.
All clients connect to a server on startup.
It is possible to send commands to all or any of the connected clients
over the common server.
This is used internally to notify file selection changes to other
clients.
.PP
To use this feature, you need to use a client which supports
communicating with a Unix domain socket.
OpenBSD implementation of netcat (nc) is one such example.
You can use it to send a command to the socket file:
.IP
.EX
echo \(aqsend echo hello world\(aq | nc \-U ${XDG_RUNTIME_DIR:\-/tmp/lf\-$(id \-u)}/lf.sock
.EE
.PP
Since such a client may not be available everywhere, lf comes bundled
with a command line flag to be used as such.
When using lf, you do not need to specify the address of the socket
file.
This is the recommended way of using remote commands since it is shorter
and immune to socket file address changes:
.IP
.EX
lf \-remote \(aqsend echo hello world\(aq
.EE
.PP
In this command \f[CR]send\f[R] is used to send the rest of the string
as a command to all connected clients.
You can optionally give it an ID number to send a command to a single
client:
.IP
.EX
lf \-remote \(aqsend 1234 echo hello world\(aq
.EE
.PP
All clients have a unique ID number but you may not be aware of the ID
number when you are writing a command.
For this purpose, an \f[CR]$id\f[R] variable is exported to the
environment for shell commands.
The value of this variable is set to the process ID of the client.
You can use it to send a remote command from a client to the server
which in return sends a command back to itself.
So now you can display a message in the current client by calling the
following in a shell command:
.IP
.EX
lf \-remote \(dqsend $id echo hello world\(dq
.EE
.PP
Since lf does not have control flow syntax, remote commands are used for
such needs.
For example, you can configure the number of columns in the UI with
respect to the terminal width as follows:
.IP
.EX
cmd recol %{{
if [ $lf_width \-le 80 ]; then
lf \-remote \(dqsend $id set ratios 1:2\(dq
elif [ $lf_width \-le 160 ]; then
lf \-remote \(dqsend $id set ratios 1:2:3\(dq
else
lf \-remote \(dqsend $id set ratios 1:2:3:5\(dq
fi
}}
.EE
.PP
In addition, the \f[CR]query\f[R] command can be used to obtain
information about a specific lf instance by providing its ID:
.IP
.EX
lf \-remote \(dqquery $id maps\(dq
.EE
.PP
The following types of information are supported:
.IP
.EX
maps list of mappings created by the \(aqmap\(aq, \(aqnmap\(aq and \(aqvmap\(aq command
nmaps list of mappings created by the \(aqnmap\(aq and \(aqmap\(aq command
vmaps list of mappings created by the \(aqvmap\(aq and \(aqmap\(aq command
cmaps list of mappings created by the \(aqcmap\(aq command
cmds list of commands created by the \(aqcmd\(aq command
jumps contents of the jump list, showing previously visited locations
history list of previously executed commands on the command line
files list of files in the currently open directory as displayed by lf, empty if dir is still loading
.EE
.PP
When listing mappings the characters in the first column are:
.IP
.EX
n Normal
v Visual
c Command\-line
.EE
.PP
This is useful for scripting actions based on the internal state of lf.
For example, to select a previous command using fzf and execute it:
.IP
.EX
map <a\-h> ${{
clear
cmd=$(
lf \-remote \(dqquery $id history\(dq |
awk \-F\(aq\(rst\(aq \(aqNR > 1 { print $NF}\(aq |
sort \-u |
fzf \-\-reverse \-\-prompt=\(aqExecute command: \(aq
)
lf \-remote \(dqsend $id $cmd\(dq
}}
.EE
.PP
The \f[CR]list\f[R] command prints the IDs of all currently connected
clients:
.IP
.EX
lf \-remote \(aqlist\(aq
.EE
.PP
There is also a \f[CR]quit\f[R] command to quit the server when there
are no connected clients left, and a \f[CR]quit!\f[R] command to force
quit the server by closing client connections first:
.IP
.EX
lf \-remote \(aqquit\(aq
lf \-remote \(aqquit!\(aq
.EE
.PP
Lastly, the commands \f[CR]conn\f[R] and \f[CR]drop\f[R] connect or
disconnect ID to/from the server:
.IP
.EX
lf \-remote \(aqconn $id\(aq
lf \-remote \(aqdrop $id\(aq
.EE
.PP
These are internal and generally not needed by users.
.SH FILE OPERATIONS
lf uses its own built\-in copy and move operations by default.
These are implemented as asynchronous operations and progress is shown
in the bottom ruler.
These commands do not overwrite existing files or directories with the
same name.
Instead, a suffix that is compatible with the
\f[CR]\-\-backup=numbered\f[R] option in GNU cp is added to the new
files or directories.
Only file modes and (some) timestamps can be preserved (see
\f[CR]preserve\f[R] option), all other attributes are ignored including
ownership, context, and xattr.
Special files such as character and block devices, named pipes, and
sockets are skipped and links are not followed.
Moving is performed using the rename operation of the underlying OS.
For cross\-device moving, lf falls back to copying and then deletes the
original files if there are no errors.
Operation errors are shown in the message line as well as the log file
and they do not prematurely terminate the corresponding file operation.
.PP
File operations can be performed on the currently selected file or on
multiple files by selecting them first.
When you \f[CR]copy\f[R] a file, lf doesn\(aqt actually copy the file on
the disk, but only records its name to a file.
The actual file copying takes place when you \f[CR]paste\f[R].
Similarly \f[CR]paste\f[R] after a \f[CR]cut\f[R] operation moves the
file.
.PP
You can customize copy and move operations by defining a
\f[CR]paste\f[R] command.
This is a special command that is called when it is defined instead of
the built\-in implementation.
You can use the following example as a starting point:
.IP
.EX
cmd paste %{{
load=$(cat \(ti/.local/share/lf/files)
mode=$(echo \(dq$load\(dq | sed \-n \(aq1p\(aq)
list=$(echo \(dq$load\(dq | sed \(aq1d\(aq)
if [ $mode = \(aqcopy\(aq ]; then
cp \-R $list .
elif [ $mode = \(aqmove\(aq ]; then
mv $list .
rm \(ti/.local/share/lf/files
lf \-remote \(aqsend clear\(aq
fi
}}
.EE
.PP
Some useful things to be considered are to use the backup
(\f[CR]\-\-backup\f[R]) and/or preserve attributes (\f[CR]\-a\f[R])
options with \f[CR]cp\f[R] and \f[CR]mv\f[R] commands if they support it
(i.e.
GNU implementation), change the command type to asynchronous, or use
\f[CR]rsync\f[R] command with progress bar option for copying and feed
the progress to the client periodically with remote \f[CR]echo\f[R]
calls.
.PP
By default, lf does not assign \f[CR]delete\f[R] command to a key to
protect new users.
You can customize file deletion by defining a \f[CR]delete\f[R] command.
You can also assign a key to this command if you like.
An example command to move selected files to a trash folder and remove
files completely after a prompt is provided in the example configuration
file.
.SH SEARCHING FILES
There are two mechanisms implemented in lf to search a file in the
current directory.
Searching is the traditional method to move the selection to a file
matching a given pattern.
Finding is an alternative way to search for a pattern possibly using
fewer keystrokes.
.PP
The searching mechanism is implemented with commands \f[CR]search\f[R]
(default \f[CR]/\f[R]), \f[CR]search\-back\f[R] (default \f[CR]?\f[R]),
\f[CR]search\-next\f[R] (default \f[CR]n\f[R]), and
\f[CR]search\-prev\f[R] (default \f[CR]N\f[R]).
You can set \f[CR]searchmethod\f[R] to \f[CR]glob\f[R] to match using a
glob pattern.
Globbing supports \f[CR]*\f[R] to match any sequence, \f[CR]?\f[R] to
match any character, and \f[CR][...]\f[R] or \f[CR][\(ha...]\f[R] to
match character sets or ranges.
You can set \f[CR]searchmethod\f[R] to \f[CR]regex\f[R] to match using a
regex pattern.
For a full overview of Go\(aqs RE2 syntax, see \c
.UR https://pkg.go.dev/regexp/syntax
.UE \c
\&.
You can enable \f[CR]incsearch\f[R] option to jump to the current match
at each keystroke while typing.
In this mode, you can either use \f[CR]cmd\-enter\f[R] to accept the
search or use \f[CR]cmd\-escape\f[R] to cancel the search.
You can also map some other commands with \f[CR]cmap\f[R] to accept the
search and execute the command immediately afterwards.
For example, you can use the right arrow key to finish the search and
open the selected file with the following mapping:
.IP
.EX
cmap <right> :cmd\-enter; open
.EE
.PP
The finding mechanism is implemented with commands \f[CR]find\f[R]
(default \f[CR]f\f[R]), \f[CR]find\-back\f[R] (default \f[CR]F\f[R]),
\f[CR]find\-next\f[R] (default \f[CR];\f[R]), \f[CR]find\-prev\f[R]
(default \f[CR],\f[R]).
You can disable \f[CR]anchorfind\f[R] option to match a pattern at an
arbitrary position in the filename instead of the beginning.
You can set the number of keys to match using \f[CR]findlen\f[R] option.
If you set this value to zero, then the keys are read until there is
only a single match.
The default values of these two options are set to jump to the first
file with the given initial.
.PP
Some options affect both searching and finding.
You can disable \f[CR]wrapscan\f[R] option to prevent searches from
being wrapped around at the end of the file list.
You can disable \f[CR]ignorecase\f[R] option to match cases in the
pattern and the filename.
This option is already automatically overridden if the pattern contains
uppercase characters.
You can disable \f[CR]smartcase\f[R] option to disable this behavior.
Two similar options \f[CR]ignoredia\f[R] and \f[CR]smartdia\f[R] are
provided to control matching diacritics in Latin letters.
.SH OPENING FILES
You can define an \f[CR]open\f[R] command (default \f[CR]l\f[R] and
\f[CR]<right>\f[R]) to configure file opening.
This command is only called when the current file is not a directory,
otherwise, the directory is entered instead.
You can define it just as you would define any other command:
.IP
.EX
cmd open $vi $fx
.EE
.PP
It is possible to use different command types:
.IP
.EX
cmd open &xdg\-open $f
.EE
.PP
You may want to use either file extensions or MIME types from
\f[CR]file\f[R] command:
.IP
.EX
cmd open ${{
case $(file \-\-mime\-type \-Lb $f) in
text/*) vi $fx;;
*) for f in $fx; do xdg\-open $f > /dev/null 2> /dev/null & done;;
esac
}}
.EE
.PP
You may want to use \f[CR]setsid\f[R] before your opener command to have
persistent processes that continue to run after lf quits.
.PP
Regular shell commands (i.e.
\f[CR]$\f[R]) drop to the terminal which results in a flicker for
commands that finish immediately (e.g.
\f[CR]xdg\-open\f[R] in the above example).
If you want to use asynchronous shell commands (i.e.
\f[CR]&\f[R]) but also want to use the terminal when necessary (e.g.
\f[CR]vi\f[R] in the above example), you can use a remote command:
.IP
.EX
cmd open &{{
case $(file \-\-mime\-type \-Lb $f) in
text/*) lf \-remote \(dqsend $id \(rs$vi \(rs$fx\(dq;;
*) for f in $fx; do xdg\-open $f > /dev/null 2> /dev/null & done;;
esac
}}
.EE
.PP
Note that asynchronous shell commands run in their own process group by
default so they do not require the manual use of \f[CR]setsid\f[R].
.PP
The following command is provided by default:
.IP
.EX
cmd open &$OPENER $f
.EE
.PP
You may also use any other existing file openers as you like.
Possible options are \f[CR]libfile\-mimeinfo\-perl\f[R] (executable name
is \f[CR]mimeopen\f[R]), \f[CR]rifle\f[R] (ranger\(aqs default file
opener), or \f[CR]mimeo\f[R] to name a few.
.SH PREVIEWING FILES
lf previews files on the preview pane by printing the file until the end
or until the preview pane is filled.
This output can be enhanced by providing a custom preview script for
filtering.
This can be used to highlight source code, list contents of archive
files or view PDF or image files to name a few.
For coloring lf recognizes ANSI escape codes.
.PP
To use this feature, you need to set the value of \f[CR]previewer\f[R]
option to the path of an executable file.
The following arguments are passed to the file, (1) current filename,
(2) width, (3) height, (4) horizontal position, (5) vertical position,
and (6) mode (\(dqpreview\(dq or \(dqpreload\(dq).
The output of the execution is printed in the preview pane.
.PP
Different types of files can be handled by matching by extension (or
MIME type from the \f[CR]file\f[R] command):
.IP
.EX
#!/bin/sh
case \(dq$1\(dq in
*.tar*) tar tf \(dq$1\(dq;;
*.zip) unzip \-l \(dq$1\(dq;;
*.rar) unrar l \(dq$1\(dq;;
*.7z) 7z l \(dq$1\(dq;;
*.pdf) pdftotext \(dq$1\(dq \-;;
*) highlight \-O ansi \(dq$1\(dq;;
esac
.EE
.PP
Because files can be large, lf automatically closes the previewer script
output pipe with a SIGPIPE when enough lines are read.
Note that some programs may not respond well to SIGPIPE and will exit
with a non\-zero return code, which avoids caching.
You may add a trailing \f[CR]|| true\f[R] command to avoid such errors:
.IP
.EX
highlight \-O ansi \(dq$1\(dq || true
.EE
.PP
You may also want to use the same script in your pager mapping as well:
.IP
.EX
set previewer \(ti/.config/lf/pv.sh
map i $\(ti/.config/lf/pv.sh $f | less \-R
.EE
.PP
For \f[CR]less\f[R] pager, you may instead utilize \f[CR]LESSOPEN\f[R]
mechanism so that useful information about the file such as the full
path of the file can still be displayed in the statusline below:
.IP
.EX
set previewer \(ti/.config/lf/pv.sh
map i $LESSOPEN=\(aq| \(ti/.config/lf/pv.sh %s\(aq less \-R $f
.EE
.PP
Since the preview script is called for each file selection change, it
may not generate previews fast enough if the user scrolls through files
quickly.
To deal with this, the \f[CR]preload\f[R] option can be set to enable
file previews to be preloaded in advance.
If enabled, the preview script will be run on files in advance as the
user navigates through them.
In this case, if the exit code of the preview script is zero, then the
output will be cached in memory and displayed by lf (useful for text or
sixel previews).
Otherwise, it will fallback to calling the preview script again when the
file is actually selected (useful for previews managed by an external
program).
.SH CHANGING DIRECTORY
lf changes the working directory of the process to the current directory
so that shell commands always work in the displayed directory.
After quitting, it returns to the original directory where it is first
launched like all shell programs.
If you want to stay in the current directory after quitting, you can use
one of the example lfcd wrapper shell scripts provided in the repository
at \c
.UR https://github.com/gokcehan/lf/tree/master/etc
.UE \c
.PP
There is a special command \f[CR]on\-cd\f[R] that runs a shell command
when it is defined and the directory is changed.
You can define it just as you would define any other command:
.IP
.EX
cmd on\-cd &{{
bash \-c \(aq
# display git repository status in your prompt
source /usr/share/git/completion/git\-prompt.sh
GIT_PS1_SHOWDIRTYSTATE=auto
GIT_PS1_SHOWSTASHSTATE=auto
GIT_PS1_SHOWUNTRACKEDFILES=auto
GIT_PS1_SHOWUPSTREAM=auto
git=$(__git_ps1 \(dq (%s)\(dq)
fmt=\(dq\(rs033[32;1m%u\(at%h\(rs033[0m:\(rs033[34;1m%d\(rs033[0m\(rs033[1m%f$git\(rs033[0m\(dq
lf \-remote \(dqsend $id set promptfmt \(rs\(dq$fmt\(rs\(dq\(dq
\(aq
}}
.EE
.PP
If you want to send escape sequences to the terminal, you can use the
\f[CR]tty\-write\f[R] command to do so.
The following xterm\-specific escape sequence sets the terminal title to
the working directory:
.IP
.EX
cmd on\-cd &{{
lf \-remote \(dqsend $id tty\-write \(rs\(dq\(rs033]0;$PWD\(rs007\(rs\(dq\(dq
}}
.EE
.PP
This command runs whenever you change the directory but not on startup.
You can add an extra call to make it run on startup as well:
.IP
.EX
cmd on\-cd &{{ ... }}
on\-cd
.EE
.PP
Note that all shell commands are possible but \f[CR]%\f[R] and
\f[CR]&\f[R] are usually more appropriate as \f[CR]$\f[R] and
\f[CR]!\f[R] causes flickers and pauses respectively.
.PP
There is also a \f[CR]pre\-cd\f[R] command, that works like
\f[CR]on\-cd\f[R], but is run before the directory is actually changed.
Another related command is \f[CR]on\-load\f[R] which gets executed when
loading a directory.
.SH LOADING DIRECTORY
Similar to \f[CR]on\-cd\f[R] there also is \f[CR]on\-load\f[R] that when
defined runs a shell command after loading a directory.
It works well when combined with \f[CR]addcustominfo\f[R].
.PP
The following example can be used to display git indicators in the info
column:
.IP
.EX
cmd on\-load &{{
cd \(dq$(dirname \(dq$1\(dq)\(dq || exit 1
[ \(dq$(git rev\-parse \-\-is\-inside\-git\-dir 2>/dev/null)\(dq = false ] || exit 0
cmds=\(dq\(dq
for file in \(dq$\(at\(dq; do
case \(dq$file\(dq in
*/.git|*/.git/*) continue;;
esac
status=$(git status \-\-porcelain \-\-ignored \-\- \(dq$file\(dq | cut \-c1\-2 | head \-n1)
if [ \-n \(dq$status\(dq ]; then
cmds=\(dq${cmds}addcustominfo \(rs\(dq${file}\(rs\(dq \(rs\(dq$status\(rs\(dq; \(dq
else
cmds=\(dq${cmds}addcustominfo \(rs\(dq${file}\(rs\(dq \(aq\(aq; \(dq
fi
done
if [ \-n \(dq$cmds\(dq ]; then
lf \-remote \(dqsend $id :$cmds\(dq
fi
}}
.EE
.PP
Another use case could be showing the dimensions of images and videos:
.IP
.EX
cmd on\-load &{{
cmds=\(dq\(dq
for file in \(dq$\(at\(dq; do
mime=$(file \-\-mime\-type \-Lb \-\- \(dq$file\(dq)
case \(dq$mime\(dq in
# vector images cause problems
image/svg+xml)
;;
image/*|video/*)
dimensions=$(exiftool \-s3 \-imagesize \-\- \(dq$file\(dq)
cmds=\(dq${cmds}addcustominfo \(rs\(dq${file}\(rs\(dq \(rs\(dq$dimensions\(rs\(dq; \(dq
;;
esac
done
if [ \-n \(dq$cmds\(dq ]; then
lf \-remote \(dqsend $id :$cmds\(dq
fi
}}
.EE
.SH COLORS
lf tries to automatically adapt its colors to the environment.
It starts with a default color scheme and updates colors using values of
existing environment variables possibly by overwriting its previous
values.
Colors are set in the following order:
.IP "1." 3
default
.IP "2." 3
LSCOLORS (macOS/BSD ls)
.IP "3." 3
LS_COLORS (GNU ls)
.IP "4." 3
LF_COLORS (lf specific)
.IP "5." 3
colors file (lf specific)
.PP
Please refer to the corresponding man pages for more information about
\f[CR]LSCOLORS\f[R] and \f[CR]LS_COLORS\f[R].
\f[CR]LF_COLORS\f[R] is provided with the same syntax as
\f[CR]LS_COLORS\f[R] in case you want to configure colors only for lf
but not ls.
This can be useful since there are some differences between ls and lf,
though one should expect the same behavior for common cases.
The colors file (refer to the \c
.UR https://github.com/gokcehan/lf/blob/master/doc.md#configuration
CONFIGURATION section
.UE \c
) is provided for easier configuration without environment variables.
This file should consist of whitespace\-separated pairs with a
\f[CR]#\f[R] character to start comments until the end of the line.
.PP
You can configure lf colors in two different ways.
First, you can only configure 8 basic colors used by your terminal and
lf should pick up those colors automatically.
Depending on your terminal, you should be able to select your colors
from a 24\-bit palette.
This is the recommended approach as colors used by other programs will
also match each other.
.PP
Second, you can set the values of environment variables or colors file
mentioned above for fine\-grained customization.
Note that \f[CR]LS_COLORS/LF_COLORS\f[R] are more powerful than
\f[CR]LSCOLORS\f[R] and they can be used even when GNU programs are not
installed on the system.
You can combine this second method with the first method for the best
results.
.PP
Lastly, you may also want to configure the colors of the prompt line to
match the rest of the colors.
Colors of the prompt line can be configured using the
\f[CR]promptfmt\f[R] option which can include hardcoded colors as ANSI
escapes.
See the default value of this option to have an idea about how to color
this line.
.PP
It is worth noting that lf uses as many colors advertised by your
terminal\(aqs entry in terminfo or infocmp databases on your system.
If an entry is not present, it falls back to an internal database.
If your terminal supports 24\-bit colors but either does not have a
database entry or does not advertise all capabilities, you can enable
support by setting the \f[CR]$COLORTERM\f[R] variable to
\f[CR]truecolor\f[R] or ensuring \f[CR]$TERM\f[R] is set to a value that
ends with \f[CR]\-truecolor\f[R].
.PP
Default lf colors are mostly taken from GNU dircolors defaults.
These defaults use 8 basic colors and bold attribute.
Default dircolors entries with background colors are simplified to avoid
confusion with current file selection in lf.
Similarly, there are only file type matchings and extension matchings
are left out for simplicity.
Default values are as follows given with their matching order in lf:
.IP
.EX
ln 01;36
or 31;01
tw 01;34
ow 01;34
st 01;34
di 01;34
pi 33
so 01;35
bd 33;01
cd 33;01
su 01;32
sg 01;32
ex 01;32
fi 00
.EE
.PP
Note that lf first tries matching file names and then falls back to file
types.
The full order of matchings from most specific to least are as follows:
.IP "1." 3
Full Path (e.g.
\f[CR]\(ti/.config/lf/lfrc\f[R])
.IP "2." 3
Dir Name (e.g.
\f[CR].git/\f[R]) (only matches dirs with a trailing slash at the end)
.IP "3." 3
File Type (e.g.
\f[CR]ln\f[R]) (except \f[CR]fi\f[R])
.IP "4." 3
File Name (e.g.
\f[CR]README*\f[R])
.IP "5." 3
File Name (e.g.
\f[CR]*README\f[R])
.IP "6." 3
Base Name (e.g.
\f[CR]README.*\f[R])
.IP "7." 3
Extension (e.g.
\f[CR]*.txt\f[R])
.IP "8." 3
Default (i.e.
\f[CR]fi\f[R])
.PP
For example, given a regular text file \f[CR]/path/to/README.txt\f[R],
the following entries are checked in the configuration and the first one
to match is used:
.IP "1." 3
\f[CR]/path/to/README.txt\f[R]
.IP "2." 3
(skipped since the file is not a directory)
.IP "3." 3
(skipped since the file is of type \f[CR]fi\f[R])
.IP "4." 3
\f[CR]README.txt*\f[R]
.IP "5." 3
\f[CR]*README.txt\f[R]
.IP "6." 3
\f[CR]README.*\f[R]
.IP "7." 3
\f[CR]*.txt\f[R]
.IP "8." 3
\f[CR]fi\f[R]
.PP
Given a regular directory \f[CR]/path/to/example.d\f[R], the following
entries are checked in the configuration and the first one to match is
used:
.IP "1." 3
\f[CR]/path/to/example.d\f[R]
.IP "2." 3
\f[CR]example.d/\f[R]
.IP "3." 3
\f[CR]di\f[R]
.IP "4." 3
\f[CR]example.d*\f[R]
.IP "5." 3
\f[CR]*example.d\f[R]
.IP "6." 3
\f[CR]example.*\f[R]
.IP "7." 3
\f[CR]*.d\f[R]
.IP "8." 3
\f[CR]fi\f[R]
.PP
Note that glob\-like patterns do not perform glob matching for
performance reasons.
.PP
For example, you can set a variable as follows:
.IP
.EX
export LF_COLORS=\(dq\(ti/Documents=01;31:\(ti/Downloads=01;31:\(ti/.local/share=01;31:\(ti/.config/lf/lfrc=31:.git/=01;32:.git*=32:*.gitignore=32:*Makefile=32:README.*=33:*.txt=34:*.md=34:ln=01;36:di=01;34:ex=01;32:\(dq
.EE
.PP
Having all entries on a single line can make it hard to read.
You may instead divide it into multiple lines in between double quotes
by escaping newlines with backslashes as follows:
.IP
.EX
export LF_COLORS=\(dq\(rs
\(ti/Documents=01;31:\(rs
\(ti/Downloads=01;31:\(rs
\(ti/.local/share=01;31:\(rs
\(ti/.config/lf/lfrc=31:\(rs
\&.git/=01;32:\(rs
\&.git*=32:\(rs
*.gitignore=32:\(rs
*Makefile=32:\(rs
README.*=33:\(rs
*.txt=34:\(rs
*.md=34:\(rs
ln=01;36:\(rs
di=01;34:\(rs
ex=01;32:\(rs
\(dq
.EE
.PP
The \f[CR]ln\f[R] entry supports the special value \f[CR]target\f[R],
which will use the link target to select a style.
Filename rules will still apply based on the link\(aqs name \-\- this
mirrors GNU\(aqs \f[CR]ls\f[R] and \f[CR]dircolors\f[R] behavior.
Having such a long variable definition in a shell configuration file
might be undesirable.
You may instead use the colors file (refer to the \c
.UR https://github.com/gokcehan/lf/blob/master/doc.md#configuration
CONFIGURATION section
.UE \c
) for configuration.
A sample colors file can be found at \c
.UR https://github.com/gokcehan/lf/blob/master/etc/colors.example
.UE \c
\ You may also see the wiki page for ANSI escape codes \c
.UR https://en.wikipedia.org/wiki/ANSI_escape_code
.UE \c
.SH ICONS
Icons are configured using \f[CR]LF_ICONS\f[R] environment variable or
an icons file (refer to the \c
.UR https://github.com/gokcehan/lf/blob/master/doc.md#configuration
CONFIGURATION section
.UE \c
).
The variable uses the same syntax as \f[CR]LS_COLORS/LF_COLORS\f[R].
Instead of colors, you should use single characters or symbols as
values.
The \f[CR]ln\f[R] entry supports the special value \f[CR]target\f[R],
which will use the link target to select a icon.
Filename rules will still apply based on the link\(aqs name \-\- this
mirrors GNU\(aqs \f[CR]ls\f[R] and \f[CR]dircolors\f[R] behavior.
The icons file (refer to the \c
.UR https://github.com/gokcehan/lf/blob/master/doc.md#configuration
CONFIGURATION section
.UE \c
) should consist of whitespace\-separated arrays with a \f[CR]#\f[R]
character to start comments until the end of the line.
Each line should contain 1\-3 columns: a file type or file name pattern,
the icon, and an optional icon color.
Using only one column disables all rules for that type or name.
Do not forget to add \f[CR]set icons true\f[R] to your \f[CR]lfrc\f[R]
to see the icons.
Default values are listed below in the order lf matches them:
.IP
.EX
ln l
or l
tw t
ow d
st t
di d
pi p
so s
bd b
cd c
su u
sg g
ex x
fi \-
.EE
.PP
A sample icons file can be found at \c
.UR https://github.com/gokcehan/lf/blob/master/etc/icons.example
.UE \c
.PP
A sample colored icons file can be found at \c
.UR https://github.com/gokcehan/lf/blob/master/etc/icons_colored.example
.UE \c
.SH RULER
The ruler can be configured using the \f[CR]rulerfile\f[R] option (refer
to the \c
.UR https://github.com/gokcehan/lf/blob/master/doc.md#configuration
CONFIGURATION section
.UE \c
).
The contents of the ruler file should be a Go template which is then
rendered to create the actual output (refer to \c
.UR https://pkg.go.dev/text/template
.UE \c
\ for more details on the syntax).
.PP
The following data fields are exported:
.IP
.EX
\&.Message string Includes internal messages, errors, and messages generated by the \(gaecho\(ga/\(gaechomsg\(ga/\(gaechoerr\(ga commands
\&.Keys string Keys pressed by the user
\&.Progress []string Progress indicators for copied, moved and deleted files
\&.Copy []string List of files in the clipboard to be copied
\&.Cut []string List of files in the clipboard to be moved
\&.Select []string Selection list
\&.Visual []string Visual selection
\&.Index int Index of the cursor
\&.Total int Number of visible files in the current working directory
\&.Hidden int Number of hidden files in the current working directory
\&.All int Number of all files in the current working directory
\&.LinePercentage string Line percentage (analogous to \(ga%p\(ga for the \(gastatusline\(ga option in Vim)
\&.ScrollPercentage string Scroll percentage (analogous to \(ga%P\(ga for the \(gastatusline\(ga option in Vim)
\&.Filter []string Filter currently being applied
\&.Mode string Current mode (\(dqNORMAL\(dq for Normal mode, and \(dqVISUAL\(dq for Visual mode)
\&.Options map[string]string The value of options (e.g. \(ga{{.Options.hidden}}\(ga)
\&.UserOptions map[string]string The value of user\-defined options (e.g. \(ga{{.UserOptions.foo}}\(ga)
\&.Stat.Path string Path of the current file
\&.Stat.Name string Name of the current file
\&.Stat.Extension string Extension of the current file
\&.Stat.Size int64 Size of the current file
\&.Stat.DirSize int64 Total size of the current directory if calculated via \(gacalcdirsize\(ga (\(ga\-1\(ga if not calculated)
\&.Stat.DirCount int Number of items in the current directory if the \(gadircounts\(ga option is enabled (\(ga\-1\(ga if the directory cannot be read)
\&.Stat.Permissions string Permissions of the current file
\&.Stat.ModTime string Last modified time of the current file (formatted based on the \(gatimefmt\(ga option)
\&.Stat.AccessTime string Last access time of the current file (formatted based on the \(gatimefmt\(ga option)
\&.Stat.BirthTime string Birth time of the current file (formatted based on the \(gatimefmt\(ga option)
\&.Stat.ChangeTime string Last status (inode) change time of the current file (formatted based on the \(gatimefmt\(ga option)
\&.Stat.LinkCount string Number of hard links for the current file
\&.Stat.User string User of the current file
\&.Stat.Group string Group of the current file
\&.Stat.Target string Target if the current file is a symbolic link, otherwise a blank string
\&.Stat.CustomInfo string Custom property if defined via \(gaaddcustominfo\(ga, otherwise a blank string
.EE
.PP
The following functions are exported:
.IP
.EX
df func() string Get an indicator representing the amount of free disk space available
env func(string) string Get the value of an environment variable
humanize func(int64) string Express a file size in a human\-readable format
join func([]string, string) string Join a string array by a separator
lower func(string) string Convert a string to lowercase
substr func(string, int, int) string Get a substring based on starting index and length
upper func(string) string Convert a string to uppercase
.EE
.PP
The special identifier \f[CR]{{.SPACER}}\f[R] can be used to divide the
ruler into sections that are spaced evenly from each other.
.PP
The default ruler file can be found at \c
.UR https://github.com/gokcehan/lf/blob/master/etc/ruler.default
.UE \c