2271 lines
84 KiB
Groff
2271 lines
84 KiB
Groff
.\" Automatically generated by Pandoc 3.7.0.2
|
|
.\"
|
|
.TH "LF" "1" "2025\-07\-07" "" "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]\-last\-dir\-path\f[R] \f[I]path\f[R]]
|
|
[\f[B]\-log 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[B]\-help\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]doc\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
|
|
.PP
|
|
You can run \f[CR]lf \-help\f[R] to see descriptions of command line
|
|
options.
|
|
.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
|
|
visual (default \(aqV\(aq)
|
|
invert (default \(aqv\(aq)
|
|
unselect (default \(aqu\(aq)
|
|
glob\-select
|
|
glob\-unselect
|
|
calcdirsize
|
|
clearmaps
|
|
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)
|
|
echo
|
|
echomsg
|
|
echoerr
|
|
cd
|
|
select
|
|
delete (modal)
|
|
rename (modal) (default \(aqr\(aq)
|
|
source
|
|
push
|
|
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)
|
|
addcustominfo
|
|
tty\-write
|
|
.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\-escape (default \(aq<esc>\(aq)
|
|
cmd\-complete (default \(aq<tab>\(aq)
|
|
cmd\-menu\-complete
|
|
cmd\-menu\-complete\-back
|
|
cmd\-menu\-accept
|
|
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 and \(aq<backspace2>\(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 and \(aq<a\-backspace2>\(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)
|
|
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)
|
|
dircache bool (default true)
|
|
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)
|
|
findlen int (default 1)
|
|
globfilter bool (default false)
|
|
globsearch bool (default false)
|
|
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)
|
|
locale string (default \(aq\(aq)
|
|
mouse bool (default false)
|
|
number bool (default false)
|
|
numberfmt string (default \(dq\(rs033[33m\(dq)
|
|
period int (default 0)
|
|
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)
|
|
roundbox bool (default false)
|
|
rulerfmt string (default \(dq %a| %p| \(rs033[7;31m %m \(rs033[0m| \(rs033[7;33m %c \(rs033[0m| \(rs033[7;35m %s \(rs033[0m| \(rs033[7;34m %f \(rs033[0m| %i/%t\(dq)
|
|
scrolloff int (default 0)
|
|
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)
|
|
sixel bool (default false)
|
|
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)
|
|
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_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 doc $$lf \-doc | $PAGER
|
|
map <f\-1> doc
|
|
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 doc !%lf% \-doc | %PAGER%
|
|
map <f\-1> doc
|
|
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 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 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 window.
|
|
|
|
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\(rsLocal\(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\(rsLocal\(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\(rsLocal\(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
|
|
%ProgramData%
|
|
C:\(rsProgramData
|
|
|
|
%LF_CONFIG_HOME%
|
|
%LOCALAPPDATA%
|
|
C:\(rsUsers\(rs<user>\(rsAppData\(rsLocal
|
|
.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 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.
|
|
.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.
|
|
.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 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 copy (default \f[CR]y\f[R])
|
|
If there are no selections, save the path of the current file to the
|
|
copy buffer, otherwise, copy the paths of selected files.
|
|
.SS cut (default \f[CR]d\f[R])
|
|
If there are no selections, save the path of the current file to the cut
|
|
buffer, otherwise, copy the paths of selected files.
|
|
.SS paste (default \f[CR]p\f[R])
|
|
Copy/Move files in the copy/cut buffer 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 copy/cut buffer.
|
|
.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 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 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 source
|
|
Read the configuration file given in the argument.
|
|
.SS push
|
|
Simulate key pushes given in the argument.
|
|
.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 in 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 file name 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 file name 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 addcustominfo
|
|
Update the \f[CR]custom\f[R] info 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 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.
|
|
.SH COMMAND LINE 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\-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\-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 item in the history.
|
|
.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] and \f[CR]<backspace2>\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]), cmd\-transpose\-word (default \f[CR]<a\-t>\f[R])
|
|
Transpose the positions of the last two characters/words.
|
|
.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] and \f[CR]<a\-backspace2>\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 OPTIONS
|
|
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 file names, 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 the box drawing characters enabled by the
|
|
\f[CR]drawbox\f[R] option.
|
|
.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 file name,
|
|
(2) width, (3) height, (4) horizontal position, (5) vertical position of
|
|
preview pane and (6) next file name 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 dircache (bool) (default true)
|
|
Cache directory contents.
|
|
.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.
|
|
.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 boxes around panes with box drawing characters.
|
|
.SS dupfilefmt (string) (default \f[CR]%f.\(ti%n\(ti\f[R])
|
|
Format string of file name 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 basename (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 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 globfilter (bool) (default false)
|
|
Patterns are treated as globs for the filter command, see
|
|
\f[CR]globsearch\f[R] for more details.
|
|
.SS globsearch (bool) (default false)
|
|
When this option is enabled, search command patterns are considered as
|
|
globs, otherwise, they are literals.
|
|
With globbing, \f[CR]*\f[R] matches any sequence, \f[CR]?\f[R] matches
|
|
any character, and \f[CR][...]\f[R] or \f[CR][\(ha...]\f[R] matches
|
|
character sets or ranges.
|
|
Otherwise, these characters are interpreted as they are.
|
|
.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 incsearch (bool) (default false)
|
|
Jump to the first match after each keystroke during searching.
|
|
.SS incfilter (bool) (default false)
|
|
Apply filter pattern after each keystroke during filtering.
|
|
.SS info ([]string) (default \(ga\(ga)
|
|
A list of information that is shown for directory items at the right
|
|
side of the pane.
|
|
Currently supported information types are \f[CR]size\f[R],
|
|
\f[CR]time\f[R], \f[CR]atime\f[R], \f[CR]ctime\f[R], \f[CR]perm\f[R],
|
|
\f[CR]user\f[R], \f[CR]group\f[R] and \f[CR]custom\f[R].
|
|
The \f[CR]custom\f[R] type is empty by default and can be updated using
|
|
the \f[CR]addcustominfo\f[R] command.
|
|
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 locale (string) (default \(ga\(ga)
|
|
An IETF BCP 47 language tag (e.g.
|
|
\f[CR]zh\-CN\f[R]) for specifying the locale used when using sort type
|
|
\f[CR]natural\f[R] and \f[CR]name\f[R].
|
|
An empty string means disable locale ordering, and the special value
|
|
\f[CR]*\f[R] is used to indicate reading the locale setting from the
|
|
system environment.
|
|
This feature is currently experimental.
|
|
.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])
|
|
Format string of the position number for each line.
|
|
.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 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.a.
|
|
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 file name,
|
|
(2) width, (3) height, (4) horizontal position, and (5) vertical
|
|
position of preview pane respectively.
|
|
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.
|
|
.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.
|
|
Special expansions are provided, \f[CR]%u\f[R] as the user name,
|
|
\f[CR]%h\f[R] as the hostname, \f[CR]%w\f[R] as the working directory,
|
|
\f[CR]%d\f[R] as the working directory with a trailing path separator,
|
|
\f[CR]%f\f[R] as the file name, and \f[CR]%F\f[R] as the current filter.
|
|
\f[CR]%S\f[R] may be used once and will provide a spacer so that the
|
|
following parts are right aligned on the screen.
|
|
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 roundbox (bool) (default false)
|
|
Draw rounded outer corners when the \f[CR]drawbox\f[R] option is
|
|
enabled.
|
|
.SS rulerfmt (string) (default \f[CR] %a| %p| \(rs033[7;31m %m \(rs033[0m| \(rs033[7;33m %c \(rs033[0m| \(rs033[7;35m %s \(rs033[0m| \(rs033[7;36m %v \(rs033[0m| \(rs033[7;34m %f \(rs033[0m| %i/%t\f[R])
|
|
Format string of the ruler shown in the bottom right corner.
|
|
Special expansions are provided, \f[CR]%a\f[R] as the pressed keys,
|
|
\f[CR]%p\f[R] as the progress of file operations, \f[CR]%m\f[R] as the
|
|
number of files to be cut (moved), \f[CR]%c\f[R] as the number of files
|
|
to be copied, \f[CR]%s\f[R] as the number of selected files,
|
|
\f[CR]%v\f[R] as the number of visually selected files, \f[CR]%f\f[R] as
|
|
the filter, \f[CR]%i\f[R] as the position of the cursor, \f[CR]%t\f[R]
|
|
as the number of files shown in the current directory, \f[CR]%h\f[R] as
|
|
the number of files hidden in the current directory, \f[CR]%P\f[R] as
|
|
the scroll percentage, and \f[CR]%d\f[R] as the amount of free disk
|
|
space remaining.
|
|
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 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 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 the half of 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 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 sixel (bool) (default false)
|
|
Render sixel images in preview.
|
|
.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.
|
|
Currently supported sort types are \f[CR]natural\f[R], \f[CR]name\f[R],
|
|
\f[CR]size\f[R], \f[CR]time\f[R], \f[CR]ctime\f[R], \f[CR]atime\f[R],
|
|
\f[CR]ext\f[R] and \f[CR]custom\f[R].
|
|
.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.
|
|
Special expansions are provided, \f[CR]%p\f[R] as the file permissions,
|
|
\f[CR]%c\f[R] as the link count, \f[CR]%u\f[R] as the user,
|
|
\f[CR]%g\f[R] as the group, \f[CR]%s\f[R] as the file size,
|
|
\f[CR]%S\f[R] as the file size but with a fixed width of four characters
|
|
(left\-padded with spaces), \f[CR]%t\f[R] as the last modified time,
|
|
\f[CR]%l\f[R] as the link target, \f[CR]%m\f[R] as the current mode and
|
|
\f[CR]%M\f[R] as the current mode but also shown in Normal mode
|
|
(displaying \f[CR]NORMAL\f[R] instead of a blank string).
|
|
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]\(ga\f[R] is always treated as
|
|
temporary and it does not need to be specified.
|
|
.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 file name does
|
|
not fit into the pane.
|
|
.SS truncatepct (int) (default 100)
|
|
When a filename is too long to be shown completely, the available space
|
|
is partitioned into two pieces.
|
|
truncatepct defines a fraction (in percent between 0 and 100) for the
|
|
size of the first piece, which will show the beginning of the filename.
|
|
The second piece will show the end of the filename and will use the rest
|
|
of the available space.
|
|
Both pieces are separated by the truncation character (truncatechar).
|
|
A value of 100 will only show the beginning of the filename, while a
|
|
value of 0 will only show the end of the filename, e.g.:
|
|
.IP \(bu 2
|
|
\f[CR]set truncatepct 100\f[R] \->
|
|
\f[CR]very\-long\-filename\-tr\(ti\f[R] (default)
|
|
.IP \(bu 2
|
|
\f[CR]set truncatepct 50\f[R] \->
|
|
\f[CR]very\-long\-f\(ti\-truncated\f[R]
|
|
.IP \(bu 2
|
|
\f[CR]set truncatepct 0\f[R] \-> \f[CR]\(ting\-filename\-truncated\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_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]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) builtin/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 w/o quotes
|
|
set sortby \(aqtime\(aq # string value with single quotes (whitespaces)
|
|
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], \f[CR]sortby\f[R] and
|
|
\f[CR]locale\f[R].
|
|
Adding a trailing path separator (i.e.
|
|
\f[CR]/\f[R] for Unix and \f[CR]\(rs\f[R] for Windows) sets the option
|
|
for the given directory along with its subdirectories:
|
|
.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 w/o quotes
|
|
setlocal /foo/bar sortby \(aqtime\(aq # string value with single quotes (whitespaces)
|
|
setlocal /foo/bar sortby \(dqtime\(dq # string value with double quotes (backslash escapes)
|
|
setlocal /foo/bar hidden # for only \(aq/foo/bar\(aq directory
|
|
setlocal /foo/bar/ hidden # for \(aq/foo/bar\(aq and its subdirectories (e.g. \(aq/foo/bar/baz\(aq)
|
|
.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 builtin command, custom command, or shell
|
|
command:
|
|
.IP
|
|
.EX
|
|
map gh cd \(ti # builtin 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 \f[CR]f\f[R] character:
|
|
.IP
|
|
.EX
|
|
map <f\-1> down
|
|
.EE
|
|
.PP
|
|
Keys combined with the control 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 key 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
|
|
WARNING: Some key combinations will likely be intercepted by your OS,
|
|
window manager, or terminal.
|
|
Other key combinations cannot be recognized by lf due to the way
|
|
terminals work (e.g.
|
|
\f[CR]Ctrl+h\f[R] combination sends a backspace key 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
|
|
map <m\-5> down
|
|
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, 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 it 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.${USER}.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
|
|
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, there is a \f[CR]conn\f[R] command to connect the server to a
|
|
client.
|
|
This should not be needed for 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 preemptively finish 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 enable \f[CR]globsearch\f[R] option to match with 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 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 effect 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
|
|
upper\-case 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 codes, 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.
|
|
Five arguments are passed to the file, (1) current file name, (2) width,
|
|
(3) height, (4) horizontal position, and (5) vertical position of
|
|
preview pane respectively.
|
|
The output of the execution is printed in the preview pane.
|
|
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 this script is called for each file selection change it needs to
|
|
be as efficient as possible and this responsibility is left to the user.
|
|
You may use file extensions to determine the type of file more
|
|
efficiently compared to obtaining mime types from \f[CR]file\f[R]
|
|
command.
|
|
Extensions can then be used to match cleanly within a conditional:
|
|
.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
|
|
Another important consideration for efficiency is the use of programs
|
|
with short startup times for preview.
|
|
For this reason, \f[CR]highlight\f[R] is recommended over
|
|
\f[CR]pygmentize\f[R] for syntax highlighting.
|
|
Besides, it is also important that the application processes the file on
|
|
the fly rather than first reading it to the memory and then doing the
|
|
processing afterwards.
|
|
This is especially relevant for big files.
|
|
lf automatically closes the previewer script output pipe with a SIGPIPE
|
|
when enough lines are read.
|
|
When everything else fails, you can make use of the height argument to
|
|
only feed the first portion of the file to a program for preview.
|
|
Note that some programs may not respond well to SIGPIPE to exit with a
|
|
non\-zero return code and avoid 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 use an existing preview filter as you like.
|
|
Your system may already come with a preview filter named
|
|
\f[CR]lesspipe\f[R].
|
|
These filters may have a mechanism to add user customizations as well.
|
|
See the related documentation for more information.
|
|
.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 (Mac/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.
|
|
File name 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 put a single characters as values of
|
|
entries.
|
|
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.
|
|
File name 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, first column is filetype or
|
|
filename pattern, second column is the icon, third column is an optional
|
|
icon color.
|
|
If there is only one column, means to disable rule for this filetype or
|
|
pattern.
|
|
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 as follows given with their matching order in lf:
|
|
.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
|