2018-07-05 20:09:53 +00:00
|
|
|
// Code generated by gen/docstring.sh DO NOT EDIT.
|
2016-09-14 23:18:50 +00:00
|
|
|
|
2016-09-13 21:40:14 +00:00
|
|
|
package main
|
|
|
|
|
2016-09-15 14:08:05 +00:00
|
|
|
var genDocString = `
|
|
|
|
lf is a terminal file manager.
|
2016-09-13 21:40:14 +00:00
|
|
|
|
2016-09-14 23:18:50 +00:00
|
|
|
Source code can be found in the repository at
|
|
|
|
https://github.com/gokcehan/lf.
|
|
|
|
|
2017-09-08 20:47:37 +00:00
|
|
|
This documentation can either be read from terminal using 'lf -doc' or
|
2018-07-07 14:50:47 +00:00
|
|
|
online at https://godoc.org/github.com/gokcehan/lf. You can also use 'doc'
|
|
|
|
command (default '<f-1>') inside lf to view the documentation in a pager.
|
2016-09-14 23:18:50 +00:00
|
|
|
|
2018-07-05 20:09:53 +00:00
|
|
|
You can run 'lf -help' to see descriptions of command line options.
|
|
|
|
|
2016-09-13 21:40:14 +00:00
|
|
|
|
2020-08-31 21:00:38 +00:00
|
|
|
Quick Reference
|
2016-09-13 21:40:14 +00:00
|
|
|
|
2020-08-31 21:00:38 +00:00
|
|
|
The following commands are provided by lf:
|
2016-09-13 21:40:14 +00:00
|
|
|
|
2020-08-31 21:00:38 +00:00
|
|
|
quit (default 'q')
|
2019-03-03 19:12:33 +00:00
|
|
|
up (default 'k' and '<up>')
|
|
|
|
half-up (default '<c-u>')
|
|
|
|
page-up (default '<c-b>' and '<pgup>')
|
|
|
|
down (default 'j' and '<down>')
|
|
|
|
half-down (default '<c-d>')
|
|
|
|
page-down (default '<c-f>' and '<pgdn>')
|
|
|
|
updir (default 'h' and '<left>')
|
|
|
|
open (default 'l' and '<right>')
|
|
|
|
top (default 'gg' and '<home>')
|
|
|
|
bottom (default 'G' and '<end>')
|
2020-08-31 21:00:38 +00:00
|
|
|
toggle
|
2019-03-03 19:12:33 +00:00
|
|
|
invert (default 'v')
|
|
|
|
unselect (default 'u')
|
2020-08-31 21:00:38 +00:00
|
|
|
glob-select
|
|
|
|
glob-unselect
|
2019-03-03 19:12:33 +00:00
|
|
|
copy (default 'y')
|
|
|
|
cut (default 'd')
|
|
|
|
paste (default 'p')
|
|
|
|
clear (default 'c')
|
2020-08-31 21:00:38 +00:00
|
|
|
sync
|
|
|
|
draw
|
2019-03-03 19:12:33 +00:00
|
|
|
redraw (default '<c-l>')
|
2020-08-31 21:00:38 +00:00
|
|
|
load
|
2019-03-03 19:12:33 +00:00
|
|
|
reload (default '<c-r>')
|
2020-08-31 21:00:38 +00:00
|
|
|
echo
|
|
|
|
echomsg
|
|
|
|
echoerr
|
|
|
|
cd
|
|
|
|
select
|
2020-09-22 01:22:08 +00:00
|
|
|
delete (modal)
|
|
|
|
rename (modal) (default 'r')
|
2020-08-31 21:00:38 +00:00
|
|
|
source
|
|
|
|
push
|
2020-09-22 01:22:08 +00:00
|
|
|
read (modal) (default ':')
|
|
|
|
shell (modal) (default '$')
|
|
|
|
shell-pipe (modal) (default '%')
|
|
|
|
shell-wait (modal) (default '!')
|
|
|
|
shell-async (modal) (default '&')
|
|
|
|
find (modal) (default 'f')
|
|
|
|
find-back (modal) (default 'F')
|
2019-03-03 19:12:33 +00:00
|
|
|
find-next (default ';')
|
|
|
|
find-prev (default ',')
|
2020-09-22 01:22:08 +00:00
|
|
|
search (modal) (default '/')
|
|
|
|
search-back (modal) (default '?')
|
2019-03-03 19:12:33 +00:00
|
|
|
search-next (default 'n')
|
|
|
|
search-prev (default 'N')
|
2021-08-21 13:40:24 +00:00
|
|
|
filter (modal)
|
|
|
|
setfilter
|
2020-09-22 01:22:08 +00:00
|
|
|
mark-save (modal) (default 'm')
|
|
|
|
mark-load (modal) (default "'")
|
|
|
|
mark-remove (modal) (default '"')
|
2016-09-13 21:40:14 +00:00
|
|
|
|
2020-08-31 21:00:38 +00:00
|
|
|
The following command line commands are provided by lf:
|
2017-03-10 15:53:21 +00:00
|
|
|
|
2019-03-03 19:12:33 +00:00
|
|
|
cmd-escape (default '<esc>')
|
|
|
|
cmd-complete (default '<tab>')
|
2020-10-14 16:42:44 +00:00
|
|
|
cmd-menu-complete
|
|
|
|
cmd-menu-complete-back
|
2019-03-03 19:12:33 +00:00
|
|
|
cmd-enter (default '<c-j>' and '<enter>')
|
2020-09-13 15:14:25 +00:00
|
|
|
cmd-interrupt (default '<c-c>')
|
2019-03-03 19:12:33 +00:00
|
|
|
cmd-history-next (default '<c-n>')
|
|
|
|
cmd-history-prev (default '<c-p>')
|
|
|
|
cmd-left (default '<c-b>' and '<left>')
|
|
|
|
cmd-right (default '<c-f>' and '<right>')
|
|
|
|
cmd-home (default '<c-a>' and '<home>')
|
|
|
|
cmd-end (default '<c-e>' and '<end>')
|
2020-09-13 15:14:25 +00:00
|
|
|
cmd-delete (default '<c-d>' and '<delete>')
|
2020-10-10 14:34:29 +00:00
|
|
|
cmd-delete-back (default '<backspace>' and '<backspace2>')
|
2019-03-03 19:12:33 +00:00
|
|
|
cmd-delete-home (default '<c-u>')
|
|
|
|
cmd-delete-end (default '<c-k>')
|
|
|
|
cmd-delete-unix-word (default '<c-w>')
|
|
|
|
cmd-yank (default '<c-y>')
|
|
|
|
cmd-transpose (default '<c-t>')
|
2020-09-13 15:14:25 +00:00
|
|
|
cmd-transpose-word (default '<a-t>')
|
2019-03-03 19:12:33 +00:00
|
|
|
cmd-word (default '<a-f>')
|
|
|
|
cmd-word-back (default '<a-b>')
|
|
|
|
cmd-delete-word (default '<a-d>')
|
2020-09-13 15:14:25 +00:00
|
|
|
cmd-capitalize-word (default '<a-c>')
|
2019-03-03 19:12:33 +00:00
|
|
|
cmd-uppercase-word (default '<a-u>')
|
|
|
|
cmd-lowercase-word (default '<a-l>')
|
2017-03-10 15:53:21 +00:00
|
|
|
|
2016-12-19 21:19:07 +00:00
|
|
|
The following options can be used to customize the behavior of lf:
|
2016-09-13 21:40:14 +00:00
|
|
|
|
2020-09-23 23:00:36 +00:00
|
|
|
anchorfind bool (default on)
|
2021-05-19 18:55:19 +00:00
|
|
|
autoquit bool (default off)
|
2021-08-01 14:04:37 +00:00
|
|
|
dircache bool (default on)
|
2020-09-23 23:00:36 +00:00
|
|
|
dircounts bool (default off)
|
|
|
|
dirfirst bool (default on)
|
2021-07-31 13:10:25 +00:00
|
|
|
dironly bool (default off)
|
2020-09-23 23:00:36 +00:00
|
|
|
drawbox bool (default off)
|
|
|
|
errorfmt string (default "\033[7;31;47m%s\033[0m")
|
|
|
|
filesep string (default "\n")
|
|
|
|
findlen int (default 1)
|
|
|
|
globsearch bool (default off)
|
|
|
|
hidden bool (default off)
|
|
|
|
hiddenfiles []string (default '.*')
|
|
|
|
icons bool (default off)
|
|
|
|
ifs string (default '')
|
|
|
|
ignorecase bool (default on)
|
2020-11-06 17:25:31 +00:00
|
|
|
ignoredia bool (default on)
|
2021-08-21 13:40:24 +00:00
|
|
|
incfilter bool (default off)
|
2020-09-23 23:00:36 +00:00
|
|
|
incsearch bool (default off)
|
|
|
|
info []string (default '')
|
2021-01-29 16:36:27 +00:00
|
|
|
mouse bool (default off)
|
2020-09-23 23:00:36 +00:00
|
|
|
number bool (default off)
|
|
|
|
period int (default 0)
|
|
|
|
preview bool (default on)
|
|
|
|
previewer string (default '')
|
2020-12-24 13:13:20 +00:00
|
|
|
cleaner string (default '')
|
2021-01-10 21:40:14 +00:00
|
|
|
promptfmt string (default "\033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f\033[0m")
|
2020-09-23 23:00:36 +00:00
|
|
|
ratios []int (default '1:2:3')
|
|
|
|
relativenumber bool (default off)
|
|
|
|
reverse bool (default off)
|
|
|
|
scrolloff int (default 0)
|
2020-10-02 20:37:39 +00:00
|
|
|
shell string (default 'sh' for unix and 'cmd' for windows)
|
2021-04-04 15:23:14 +00:00
|
|
|
shellflag string (default '-c' for unix and '/c' for windows)
|
2020-09-23 23:00:36 +00:00
|
|
|
shellopts []string (default '')
|
|
|
|
smartcase bool (default on)
|
|
|
|
smartdia bool (default off)
|
|
|
|
sortby string (default 'natural')
|
|
|
|
tabstop int (default 8)
|
2022-01-30 23:28:06 +00:00
|
|
|
tempmarks string (default '')
|
2020-09-23 23:00:36 +00:00
|
|
|
timefmt string (default 'Mon Jan _2 15:04:05 2006')
|
|
|
|
truncatechar string (default '~')
|
2021-04-06 15:57:23 +00:00
|
|
|
waitmsg string (default 'Press any key to continue')
|
2020-09-23 23:00:36 +00:00
|
|
|
wrapscan bool (default on)
|
|
|
|
wrapscroll bool (default off)
|
2016-09-13 21:40:14 +00:00
|
|
|
|
2020-10-02 20:37:39 +00:00
|
|
|
The following environment variables are exported for shell commands:
|
2016-09-13 21:40:14 +00:00
|
|
|
|
2020-10-02 20:37:39 +00:00
|
|
|
f
|
|
|
|
fs
|
|
|
|
fx
|
|
|
|
id
|
2021-03-19 11:00:00 +00:00
|
|
|
PWD
|
2021-04-13 20:48:49 +00:00
|
|
|
OLDPWD
|
2020-10-02 20:37:39 +00:00
|
|
|
LF_LEVEL
|
|
|
|
OPENER
|
|
|
|
EDITOR
|
|
|
|
PAGER
|
|
|
|
SHELL
|
2016-09-13 21:40:14 +00:00
|
|
|
|
2020-10-02 20:37:39 +00:00
|
|
|
The following commands/keybindings are provided by default:
|
2020-09-13 11:54:57 +00:00
|
|
|
|
2020-10-02 20:37:39 +00:00
|
|
|
unix windows
|
|
|
|
cmd open &$OPENER "$f" cmd open &%OPENER% %f%
|
|
|
|
map e $$EDITOR "$f" map e $%EDITOR% %f%
|
|
|
|
map i $$PAGER "$f" map i !%PAGER% %f%
|
|
|
|
map w $$SHELL map w $%SHELL%
|
2018-06-28 21:34:21 +00:00
|
|
|
|
2018-03-02 20:15:36 +00:00
|
|
|
The following additional keybindings are provided by default:
|
|
|
|
|
|
|
|
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
|
2019-09-18 18:52:30 +00:00
|
|
|
map sa :set sortby atime; set info atime
|
|
|
|
map sc :set sortby ctime; set info ctime
|
2019-10-04 18:49:18 +00:00
|
|
|
map se :set sortby ext; set info
|
2018-03-02 20:15:36 +00:00
|
|
|
map gh cd ~
|
2020-06-17 03:35:28 +00:00
|
|
|
map <space> :toggle; down
|
2018-03-02 20:15:36 +00:00
|
|
|
|
2016-09-15 14:08:05 +00:00
|
|
|
|
|
|
|
Configuration
|
|
|
|
|
2018-06-28 17:23:41 +00:00
|
|
|
Configuration files should be located at:
|
2016-12-19 21:19:07 +00:00
|
|
|
|
2018-07-05 20:09:53 +00:00
|
|
|
os system-wide user-specific
|
2018-07-13 19:46:37 +00:00
|
|
|
unix /etc/lf/lfrc ~/.config/lf/lfrc
|
2018-06-28 17:23:41 +00:00
|
|
|
windows C:\ProgramData\lf\lfrc C:\Users\<user>\AppData\Local\lf\lfrc
|
2016-12-19 21:19:07 +00:00
|
|
|
|
2021-05-19 19:25:26 +00:00
|
|
|
Selection file should be located at:
|
|
|
|
|
|
|
|
unix ~/.local/share/lf/files
|
|
|
|
windows C:\Users\<user>\AppData\Local\lf\files
|
|
|
|
|
2018-07-12 18:47:19 +00:00
|
|
|
Marks file should be located at:
|
|
|
|
|
|
|
|
unix ~/.local/share/lf/marks
|
|
|
|
windows C:\Users\<user>\AppData\Local\lf\marks
|
|
|
|
|
|
|
|
History file should be located at:
|
|
|
|
|
|
|
|
unix ~/.local/share/lf/history
|
|
|
|
windows C:\Users\<user>\AppData\Local\lf\history
|
|
|
|
|
2018-06-28 17:23:41 +00:00
|
|
|
You can configure the default values of following variables to change these
|
|
|
|
locations:
|
2016-12-19 21:19:07 +00:00
|
|
|
|
2018-06-28 17:23:41 +00:00
|
|
|
$XDG_CONFIG_HOME ~/.config
|
2018-07-12 18:47:19 +00:00
|
|
|
$XDG_DATA_HOME ~/.local/share
|
2018-06-28 17:23:41 +00:00
|
|
|
%ProgramData% C:\ProgramData
|
|
|
|
%LOCALAPPDATA% C:\Users\<user>\AppData\Local
|
2016-12-19 21:19:07 +00:00
|
|
|
|
|
|
|
A sample configuration file can be found at
|
2016-09-14 23:18:50 +00:00
|
|
|
https://github.com/gokcehan/lf/blob/master/etc/lfrc.example.
|
2016-09-13 21:40:14 +00:00
|
|
|
|
2016-09-14 23:18:50 +00:00
|
|
|
|
2020-08-31 21:00:38 +00:00
|
|
|
Commands
|
|
|
|
|
2020-09-22 01:22:08 +00:00
|
|
|
This section shows information about builtin 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.
|
2020-08-31 21:00:38 +00:00
|
|
|
|
|
|
|
quit (default 'q')
|
|
|
|
|
|
|
|
Quit lf and return to the shell.
|
|
|
|
|
|
|
|
up (default 'k' and '<up>')
|
|
|
|
half-up (default '<c-u>')
|
|
|
|
page-up (default '<c-b>' and '<pgup>')
|
|
|
|
down (default 'j' and '<down>')
|
|
|
|
half-down (default '<c-d>')
|
|
|
|
page-down (default '<c-f>' and '<pgdn>')
|
|
|
|
|
|
|
|
Move the current file selection upwards/downwards by one/half a page/full
|
|
|
|
page.
|
|
|
|
|
|
|
|
updir (default 'h' and '<left>')
|
|
|
|
|
|
|
|
Change the current working directory to the parent directory.
|
|
|
|
|
|
|
|
open (default 'l' and '<right>')
|
|
|
|
|
|
|
|
If the current file is a directory, then change the current directory to it,
|
|
|
|
otherwise, execute the 'open' command. A default 'open' command is provided
|
|
|
|
to call the default system opener asynchronously with the current file as
|
|
|
|
the argument. A custom 'open' command can be defined to override this
|
|
|
|
default.
|
|
|
|
|
|
|
|
(See also 'OPENER' variable and 'Opening Files' section)
|
|
|
|
|
|
|
|
top (default 'gg' and '<home>')
|
|
|
|
bottom (default 'G' and '<end>')
|
|
|
|
|
|
|
|
Move the current file selection to the top/bottom of the directory.
|
|
|
|
|
|
|
|
toggle
|
|
|
|
|
|
|
|
Toggle the selection of the current file or files given as arguments.
|
|
|
|
|
|
|
|
invert (default 'v')
|
|
|
|
|
|
|
|
Reverse the selection of all files in the current directory (i.e. 'toggle'
|
|
|
|
all files). Selections in other directories are not effected by this
|
|
|
|
command. You can define a new command to select all files in the directory
|
|
|
|
by combining 'invert' with 'unselect' (i.e. 'cmd select-all :unselect;
|
|
|
|
invert'), though this will also remove selections in other directories.
|
|
|
|
|
|
|
|
unselect (default 'u')
|
|
|
|
|
|
|
|
Remove the selection of all files in all directories.
|
|
|
|
|
|
|
|
glob-select
|
|
|
|
|
|
|
|
Select files that match the given glob.
|
|
|
|
|
|
|
|
glob-unselect
|
|
|
|
|
|
|
|
Unselect files that match the given glob.
|
|
|
|
|
|
|
|
copy (default 'y')
|
|
|
|
|
|
|
|
If there are no selections, save the path of the current file to the copy
|
|
|
|
buffer, otherwise, copy the paths of selected files.
|
|
|
|
|
|
|
|
cut (default 'd')
|
|
|
|
|
|
|
|
If there are no selections, save the path of the current file to the cut
|
|
|
|
buffer, otherwise, copy the paths of selected files.
|
|
|
|
|
|
|
|
paste (default 'p')
|
|
|
|
|
|
|
|
Copy/Move files in copy/cut buffer to the current working directory.
|
|
|
|
|
|
|
|
clear (default 'c')
|
|
|
|
|
|
|
|
Clear file paths in copy/cut buffer.
|
|
|
|
|
|
|
|
sync
|
|
|
|
|
|
|
|
Synchronize copied/cut files with server. This command is automatically
|
|
|
|
called when required.
|
|
|
|
|
|
|
|
draw
|
|
|
|
|
|
|
|
Draw the screen. This command is automatically called when required.
|
|
|
|
|
|
|
|
redraw (default '<c-l>')
|
|
|
|
|
|
|
|
Synchronize the terminal and redraw the screen.
|
|
|
|
|
|
|
|
load
|
|
|
|
|
|
|
|
Load modified files and directories. This command is automatically called
|
|
|
|
when required.
|
|
|
|
|
|
|
|
reload (default '<c-r>')
|
|
|
|
|
|
|
|
Flush the cache and reload all files and directories.
|
|
|
|
|
|
|
|
echo
|
|
|
|
|
|
|
|
Print given arguments to the message line at the bottom.
|
|
|
|
|
|
|
|
echomsg
|
|
|
|
|
|
|
|
Print given arguments to the message line at the bottom and also to the log
|
|
|
|
file.
|
|
|
|
|
|
|
|
echoerr
|
|
|
|
|
|
|
|
Print given arguments to the message line at the bottom in red color and
|
|
|
|
also to the log file.
|
|
|
|
|
|
|
|
cd
|
|
|
|
|
|
|
|
Change the working directory to the given argument.
|
|
|
|
|
|
|
|
select
|
|
|
|
|
|
|
|
Change the current file selection to the given argument.
|
|
|
|
|
2020-09-22 01:22:08 +00:00
|
|
|
delete (modal)
|
2020-08-31 21:00:38 +00:00
|
|
|
|
|
|
|
Remove the current file or selected file(s).
|
|
|
|
|
2020-09-22 01:22:08 +00:00
|
|
|
rename (modal) (default 'r')
|
2020-08-31 21:00:38 +00:00
|
|
|
|
|
|
|
Rename the current file using the builtin method. A custom 'rename' command
|
|
|
|
can be defined to override this default.
|
|
|
|
|
|
|
|
source
|
|
|
|
|
|
|
|
Read the configuration file given in the argument.
|
|
|
|
|
|
|
|
push
|
|
|
|
|
|
|
|
Simulate key pushes given in the argument.
|
|
|
|
|
2020-09-22 01:22:08 +00:00
|
|
|
read (modal) (default ':')
|
2020-08-31 21:00:38 +00:00
|
|
|
|
|
|
|
Read a command to evaluate.
|
|
|
|
|
2020-09-22 01:22:08 +00:00
|
|
|
shell (modal) (default '$')
|
2020-08-31 21:00:38 +00:00
|
|
|
|
|
|
|
Read a shell command to execute.
|
|
|
|
|
|
|
|
(See also 'Prefixes' and 'Shell Commands' sections)
|
|
|
|
|
2020-09-22 01:22:08 +00:00
|
|
|
shell-pipe (modal) (default '%')
|
2020-08-31 21:00:38 +00:00
|
|
|
|
|
|
|
Read a shell command to execute piping its standard I/O to the bottom
|
|
|
|
statline.
|
|
|
|
|
|
|
|
(See also 'Prefixes' and 'Piping Shell Commands' sections)
|
|
|
|
|
2020-09-22 01:22:08 +00:00
|
|
|
shell-wait (modal) (default '!')
|
2020-08-31 21:00:38 +00:00
|
|
|
|
|
|
|
Read a shell command to execute and wait for a key press in the end.
|
|
|
|
|
|
|
|
(See also 'Prefixes' and 'Waiting Shell Commands' sections)
|
|
|
|
|
2020-09-22 01:22:08 +00:00
|
|
|
shell-async (modal) (default '&')
|
2020-08-31 21:00:38 +00:00
|
|
|
|
2021-06-12 21:36:48 +00:00
|
|
|
Read a shell command to execute asynchronously without standard I/O.
|
2020-08-31 21:00:38 +00:00
|
|
|
|
2020-09-22 01:22:08 +00:00
|
|
|
find (modal) (default 'f')
|
|
|
|
find-back (modal) (default 'F')
|
2020-08-31 21:00:38 +00:00
|
|
|
find-next (default ';')
|
|
|
|
find-prev (default ',')
|
|
|
|
|
|
|
|
Read key(s) to find the appropriate file name match in the forward/backward
|
2020-09-13 15:14:25 +00:00
|
|
|
direction and jump to the next/previous match.
|
2020-08-31 21:00:38 +00:00
|
|
|
|
|
|
|
(See also 'anchorfind', 'findlen', 'wrapscan', 'ignorecase', 'smartcase',
|
|
|
|
'ignoredia', and 'smartdia' options and 'Searching Files' section)
|
|
|
|
|
|
|
|
search (default '/')
|
|
|
|
search-back (default '?')
|
|
|
|
search-next (default 'n')
|
|
|
|
search-prev (default 'N')
|
|
|
|
|
|
|
|
Read a pattern to search for a file name match in the forward/backward
|
2020-09-13 15:14:25 +00:00
|
|
|
direction and jump to the next/previous match.
|
2020-08-31 21:00:38 +00:00
|
|
|
|
|
|
|
(See also 'globsearch', 'incsearch', 'wrapscan', 'ignorecase', 'smartcase',
|
|
|
|
'ignoredia', and 'smartdia' options and 'Searching Files' section)
|
|
|
|
|
2021-08-21 13:40:24 +00:00
|
|
|
filter (modal)
|
|
|
|
setfilter
|
|
|
|
|
|
|
|
Read a pattern to filter out and only view files matching the pattern.
|
|
|
|
setfilter does the same but uses an argument to set the filter immediatly.
|
|
|
|
You can supply an argument to filter, in order to use that as the starting
|
|
|
|
prompt.
|
|
|
|
|
|
|
|
(See also 'globsearch', 'incfilter', 'ignorecase', 'smartcase', 'ignoredia',
|
|
|
|
and 'smartdia' options)
|
|
|
|
|
2020-09-22 01:22:08 +00:00
|
|
|
mark-save (modal) (default 'm')
|
2020-08-31 21:00:38 +00:00
|
|
|
|
|
|
|
Save the current directory as a bookmark assigned to the given key.
|
|
|
|
|
2020-09-22 01:22:08 +00:00
|
|
|
mark-load (modal) (default "'")
|
2020-08-31 21:00:38 +00:00
|
|
|
|
2020-09-22 01:22:08 +00:00
|
|
|
Change the current directory to the bookmark assigned to the given key. A
|
|
|
|
special bookmark "'" holds the previous directory after a 'mark-load', 'cd',
|
|
|
|
or 'select' command.
|
2020-08-31 21:00:38 +00:00
|
|
|
|
2020-09-22 01:22:08 +00:00
|
|
|
mark-remove (modal) (default '"')
|
2020-08-31 21:00:38 +00:00
|
|
|
|
|
|
|
Remove a bookmark assigned to the given key.
|
|
|
|
|
|
|
|
|
2020-09-13 15:14:25 +00:00
|
|
|
Command Line Commands
|
|
|
|
|
|
|
|
This section shows information about command line commands. These 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.
|
|
|
|
|
|
|
|
cmd-escape (default '<esc>')
|
|
|
|
|
|
|
|
Quit command line mode and return to normal mode.
|
|
|
|
|
|
|
|
cmd-complete (default '<tab>')
|
|
|
|
|
|
|
|
Autocomplete the current word.
|
|
|
|
|
2020-10-14 16:42:44 +00:00
|
|
|
cmd-menu-complete
|
|
|
|
|
2020-11-06 12:48:28 +00:00
|
|
|
Autocomplete the current word, then you can press the binded key/s again to
|
|
|
|
cycle completition options.
|
2020-10-14 16:42:44 +00:00
|
|
|
|
|
|
|
cmd-menu-complete-back
|
|
|
|
|
2020-11-06 12:48:28 +00:00
|
|
|
Autocomplete the current word, then you can press the binded key/s again to
|
|
|
|
cycle completition options backwards.
|
2020-10-14 16:42:44 +00:00
|
|
|
|
2020-09-13 15:14:25 +00:00
|
|
|
cmd-enter (default '<c-j>' and '<enter>')
|
|
|
|
|
|
|
|
Execute the current line.
|
|
|
|
|
|
|
|
cmd-interrupt (default '<c-c>')
|
|
|
|
|
|
|
|
Interrupt the current shell-pipe command and return to the normal mode.
|
|
|
|
|
|
|
|
cmd-history-next (default '<c-n>')
|
|
|
|
cmd-history-prev (default '<c-p>')
|
|
|
|
|
|
|
|
Go to next/previous item in the history.
|
|
|
|
|
|
|
|
cmd-left (default '<c-b>' and '<left>')
|
|
|
|
cmd-right (default '<c-f>' and '<right>')
|
|
|
|
|
|
|
|
Move the cursor to the left/right.
|
|
|
|
|
|
|
|
cmd-home (default '<c-a>' and '<home>')
|
|
|
|
cmd-end (default '<c-e>' and '<end>')
|
|
|
|
|
|
|
|
Move the cursor to the beginning/end of line.
|
|
|
|
|
|
|
|
cmd-delete (default '<c-d>' and '<delete>')
|
2020-10-10 14:34:29 +00:00
|
|
|
cmd-delete-back (default '<backspace>' and '<backspace2>')
|
2020-09-13 15:14:25 +00:00
|
|
|
|
|
|
|
Delete the next character in forward/backward direction.
|
|
|
|
|
|
|
|
cmd-delete-home (default '<c-u>')
|
|
|
|
cmd-delete-end (default '<c-k>')
|
|
|
|
|
|
|
|
Delete everything up to the beginning/end of line.
|
|
|
|
|
|
|
|
cmd-delete-unix-word (default '<c-w>')
|
|
|
|
|
|
|
|
Delete the previous unix word.
|
|
|
|
|
|
|
|
cmd-yank (default '<c-y>')
|
|
|
|
|
|
|
|
Paste the buffer content containing the last deleted item.
|
|
|
|
|
|
|
|
cmd-transpose (default '<c-t>')
|
|
|
|
cmd-transpose-word (default '<a-t>')
|
|
|
|
|
|
|
|
Transpose the positions of last two characters/words.
|
|
|
|
|
|
|
|
cmd-word (default '<a-f>')
|
|
|
|
cmd-word-back (default '<a-b>')
|
|
|
|
|
|
|
|
Move the cursor by one word in forward/backward direction.
|
|
|
|
|
|
|
|
cmd-delete-word (default '<a-d>')
|
|
|
|
|
|
|
|
Delete the next word in forward direction.
|
|
|
|
|
|
|
|
cmd-capitalize-word (default '<a-c>')
|
|
|
|
cmd-uppercase-word (default '<a-u>')
|
|
|
|
cmd-lowercase-word (default '<a-l>')
|
|
|
|
|
|
|
|
Capitalize/uppercase/lowercase the current word and jump to the next word.
|
|
|
|
|
|
|
|
|
2020-09-23 23:00:36 +00:00
|
|
|
Options
|
|
|
|
|
|
|
|
This section shows information about options to customize the behavior.
|
|
|
|
Character ':' is used as the separator for list options '[]int' and
|
|
|
|
'[]string'.
|
|
|
|
|
|
|
|
anchorfind bool (default on)
|
|
|
|
|
|
|
|
When this option is enabled, find command starts matching patterns from the
|
|
|
|
beginning of file names, otherwise, it can match at an arbitrary position.
|
|
|
|
|
2021-05-19 18:55:19 +00:00
|
|
|
autoquit bool (default off)
|
|
|
|
|
|
|
|
Automatically quit server when there are no clients left connected.
|
|
|
|
|
2021-08-01 14:04:37 +00:00
|
|
|
dircache bool (default on)
|
|
|
|
|
|
|
|
Cache directory contents.
|
|
|
|
|
2020-09-23 23:00:36 +00:00
|
|
|
dircounts bool (default off)
|
|
|
|
|
|
|
|
When this option is enabled, directory sizes show the number of items inside
|
|
|
|
instead of the size of directory file. The former needs to be calculated by
|
|
|
|
reading the directory and counting the items inside. The latter is directly
|
|
|
|
provided by the operating system and it does not require any calculation,
|
|
|
|
though it is non-intuitive and it can often be misleading. This option is
|
|
|
|
disabled by default for performance reasons. This option only has an effect
|
|
|
|
when 'info' has a 'size' field and the pane is wide enough to show the
|
|
|
|
information. A thousand items are counted per directory at most, and bigger
|
|
|
|
directories are shown as '999+'.
|
|
|
|
|
|
|
|
dirfirst bool (default on)
|
|
|
|
|
|
|
|
Show directories first above regular files.
|
|
|
|
|
2021-07-31 13:10:25 +00:00
|
|
|
dironly bool (default off)
|
|
|
|
|
|
|
|
Show only directories.
|
|
|
|
|
2020-09-23 23:00:36 +00:00
|
|
|
drawbox bool (default off)
|
|
|
|
|
|
|
|
Draw boxes around panes with box drawing characters.
|
|
|
|
|
|
|
|
errorfmt string (default "\033[7;31;47m%s\033[0m")
|
|
|
|
|
|
|
|
Format string of error messages shown in the bottom message line.
|
|
|
|
|
|
|
|
filesep string (default "\n")
|
|
|
|
|
|
|
|
File separator used in environment variables 'fs' and 'fx'.
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
globsearch bool (default off)
|
|
|
|
|
|
|
|
When this option is enabled, search command patterns are considered as
|
|
|
|
globs, otherwise they are literals. With globbing, '*' matches any sequence,
|
|
|
|
'?' matches any character, and '[...]' or '[^...] matches character sets or
|
|
|
|
ranges. Otherwise, these characters are interpreted as they are.
|
|
|
|
|
|
|
|
hidden bool (default off)
|
|
|
|
|
|
|
|
Show hidden files. On unix systems, hidden files are determined by the value
|
|
|
|
of 'hiddenfiles'. On windows, only files with hidden attributes are
|
|
|
|
considered hidden files.
|
|
|
|
|
|
|
|
hiddenfiles []string (default '.*')
|
|
|
|
|
|
|
|
List of hidden file glob patterns. Patterns can be given as relative or
|
|
|
|
absolute paths. Globbing supports the usual special characters, '*' to match
|
|
|
|
any sequence, '?' to match any character, and '[...]' or '[^...] to match
|
|
|
|
character sets or ranges. In addition, if a pattern starts with '!', then
|
|
|
|
its matches are excluded from hidden files.
|
|
|
|
|
|
|
|
icons bool (default off)
|
|
|
|
|
|
|
|
Show icons before each item in the list. By default, only two icons, 🗀
|
|
|
|
(U+1F5C0) and 🗎 (U+1F5CE), are used for directories and files respectively,
|
|
|
|
as they are supported in the unicode standard. Icons can be configured with
|
|
|
|
an environment variable named 'LF_ICONS'. The syntax of this variable is
|
|
|
|
similar to 'LS_COLORS'. See the wiki page for an example icon configuration.
|
|
|
|
|
|
|
|
ifs string (default '')
|
|
|
|
|
|
|
|
Sets 'IFS' variable in shell commands. It works by adding the assignment to
|
|
|
|
the beginning of the command string as 'IFS='...'; ...'. The reason is that
|
|
|
|
'IFS' variable is not inherited by the shell for security reasons. This
|
|
|
|
method assumes a POSIX shell syntax and 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.
|
|
|
|
|
|
|
|
ignorecase bool (default on)
|
|
|
|
|
2020-11-06 12:48:28 +00:00
|
|
|
Ignore case in sorting and search patterns.
|
2020-09-23 23:00:36 +00:00
|
|
|
|
2020-11-06 17:25:31 +00:00
|
|
|
ignoredia bool (default on)
|
2020-09-23 23:00:36 +00:00
|
|
|
|
2020-11-06 12:48:28 +00:00
|
|
|
Ignore diacritics in sorting and search patterns.
|
2020-09-23 23:00:36 +00:00
|
|
|
|
|
|
|
incsearch bool (default off)
|
|
|
|
|
|
|
|
Jump to the first match after each keystroke during searching.
|
|
|
|
|
2021-08-21 13:40:24 +00:00
|
|
|
incfilter bool (default off)
|
|
|
|
|
|
|
|
Apply filter pattern after each keystroke during filtering.
|
|
|
|
|
2020-09-23 23:00:36 +00:00
|
|
|
info []string (default '')
|
|
|
|
|
|
|
|
List of information shown for directory items at the right side of pane.
|
|
|
|
Currently supported information types are 'size', 'time', 'atime', and
|
|
|
|
'ctime'. Information is only shown when the pane width is more than twice
|
|
|
|
the width of information.
|
|
|
|
|
2021-01-29 16:36:27 +00:00
|
|
|
mouse bool (default off)
|
|
|
|
|
|
|
|
Send mouse events as input.
|
|
|
|
|
2020-09-23 23:00:36 +00:00
|
|
|
number bool (default off)
|
|
|
|
|
|
|
|
Show the position number for directory items at the left side of pane. When
|
|
|
|
'relativenumber' is enabled, only the current line shows the absolute
|
|
|
|
position and relative positions are shown for the rest.
|
|
|
|
|
|
|
|
period int (default 0)
|
|
|
|
|
|
|
|
Set the interval in seconds for periodic checks of directory updates. This
|
|
|
|
works by periodically calling the 'load' 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.
|
|
|
|
|
|
|
|
preview bool (default on)
|
|
|
|
|
|
|
|
Show previews of files and directories at the right most pane. If the file
|
|
|
|
has more lines than the preview pane, 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 'binary'.
|
|
|
|
|
|
|
|
previewer string (default '') (not filtered if empty)
|
|
|
|
|
|
|
|
Set the path of a previewer file to filter the content of regular files for
|
2020-12-24 13:13:20 +00:00
|
|
|
previewing. The file should be executable. Five arguments are passed to the
|
|
|
|
file, first is the current file name; the second, third, fourth, and fifth
|
2021-01-02 22:35:30 +00:00
|
|
|
are width, height, horizontal position, and vertical position of preview
|
2020-12-24 13:13:20 +00:00
|
|
|
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.
|
|
|
|
|
|
|
|
cleaner string (default '') (not called if empty)
|
|
|
|
|
|
|
|
Set the path of a cleaner file. This file will be called if previewing is
|
|
|
|
enabled, the previewer is set, and the previously selected file had its
|
2020-12-27 01:23:03 +00:00
|
|
|
preview cache disabled. The file should be executable. One argument is
|
|
|
|
passed to the file; the path to the file whose preview should be cleaned.
|
|
|
|
Preview clearing is disabled when the value of this option is left empty.
|
2020-09-23 23:00:36 +00:00
|
|
|
|
2021-01-18 16:02:51 +00:00
|
|
|
promptfmt string (default "\033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f\033[0m")
|
2020-09-23 23:00:36 +00:00
|
|
|
|
|
|
|
Format string of the prompt shown in the top line. Special expansions are
|
|
|
|
provided, '%u' as the user name, '%h' as the host name, '%w' as the working
|
2021-10-09 21:01:01 +00:00
|
|
|
directory, '%d' as the working directory with a trailing path separator,
|
|
|
|
'%f' as the file name, and '%F' as the current filter. Home folder is shown
|
|
|
|
as '~' in the working directory expansion. Directory names are automatically
|
|
|
|
shortened to a single character starting from the left most parent when the
|
|
|
|
prompt does not fit to the screen.
|
2020-09-23 23:00:36 +00:00
|
|
|
|
|
|
|
ratios []int (default '1:2:3')
|
|
|
|
|
|
|
|
List of ratios of pane widths. Number of items in the list determines the
|
|
|
|
number of panes in the ui. When 'preview' option is enabled, the right most
|
|
|
|
number is used for the width of preview pane.
|
|
|
|
|
|
|
|
relativenumber bool (default off)
|
|
|
|
|
|
|
|
Show the position number relative to the current line. When 'number' is
|
|
|
|
enabled, current line shows the absolute position, otherwise nothing is
|
|
|
|
shown.
|
|
|
|
|
|
|
|
reverse bool (default off)
|
|
|
|
|
|
|
|
Reverse the direction of sort.
|
|
|
|
|
|
|
|
scrolloff int (default 0)
|
|
|
|
|
|
|
|
Minimum number of offset lines shown at all times in the top and the 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.
|
|
|
|
|
2020-10-02 20:37:39 +00:00
|
|
|
shell string (default 'sh' for unix and 'cmd' for windows)
|
2020-09-23 23:00:36 +00:00
|
|
|
|
2021-02-27 19:56:18 +00:00
|
|
|
Shell executable to use for shell commands. Shell commands are executed as
|
2021-04-04 15:23:14 +00:00
|
|
|
'shell shellopts shellflag command -- arguments'.
|
|
|
|
|
|
|
|
shellflag string (default '-c' for unix and '/c' for windows)
|
|
|
|
|
|
|
|
Command line flag used to pass shell commands.
|
2020-09-23 23:00:36 +00:00
|
|
|
|
|
|
|
shellopts []string (default '')
|
|
|
|
|
|
|
|
List of shell options to pass to the shell executable.
|
|
|
|
|
|
|
|
smartcase bool (default on)
|
|
|
|
|
|
|
|
Override 'ignorecase' option when the pattern contains an uppercase
|
|
|
|
character. This option has no effect when 'ignorecase' is disabled.
|
|
|
|
|
|
|
|
smartdia bool (default off)
|
|
|
|
|
|
|
|
Override 'ignoredia' option when the pattern contains a character with
|
|
|
|
diacritic. This option has no effect when 'ignoredia' is disabled.
|
|
|
|
|
|
|
|
sortby string (default 'natural')
|
|
|
|
|
|
|
|
Sort type for directories. Currently supported sort types are 'natural',
|
|
|
|
'name', 'size', 'time', 'ctime', 'atime', and 'ext'.
|
|
|
|
|
|
|
|
tabstop int (default 8)
|
|
|
|
|
|
|
|
Number of space characters to show for horizontal tabulation (U+0009)
|
|
|
|
character.
|
|
|
|
|
2022-01-30 23:28:06 +00:00
|
|
|
tempmarks string (default '')
|
|
|
|
|
|
|
|
A string that lists all marks to treat as temporary. They are not synced to
|
|
|
|
other clients and are not saved in the bookmarks file. This option should be
|
|
|
|
specified only in the global config file ("lfrc") as it may otherwise cause
|
|
|
|
unintended side effects. Please note that the special bookmark "'" is always
|
|
|
|
treated as temporary and does not need to be specified.
|
|
|
|
|
2020-09-23 23:00:36 +00:00
|
|
|
timefmt string (default 'Mon Jan _2 15:04:05 2006')
|
|
|
|
|
|
|
|
Format string of the file modification time shown in the bottom line.
|
|
|
|
|
|
|
|
truncatechar string (default '~')
|
|
|
|
|
|
|
|
Truncate character shown at the end when the file name does not fit to the
|
|
|
|
pane.
|
|
|
|
|
2021-04-06 15:57:23 +00:00
|
|
|
waitmsg string (default 'Press any key to continue')
|
|
|
|
|
|
|
|
String shown after commands of shell-wait type.
|
|
|
|
|
2020-09-23 23:00:36 +00:00
|
|
|
wrapscan bool (default on)
|
|
|
|
|
|
|
|
Searching can wrap around the file list.
|
|
|
|
|
|
|
|
wrapscroll bool (default off)
|
|
|
|
|
|
|
|
Scrolling can wrap around the file list.
|
|
|
|
|
|
|
|
|
2020-10-02 20:37:39 +00:00
|
|
|
Environment Variables
|
|
|
|
|
|
|
|
The following variables are exported for shell commands: These are referred
|
|
|
|
with a '$' prefix on POSIX shells (e.g. '$f'), between '%' characters on
|
|
|
|
Windows cmd (e.g. '%f%'), and with a '$env:' prefix on Windows powershell
|
|
|
|
(e.g. '$env:f').
|
|
|
|
|
|
|
|
f
|
|
|
|
|
|
|
|
Current file selection as a full path.
|
|
|
|
|
|
|
|
fs
|
|
|
|
|
|
|
|
Selected file(s) separated with the value of 'filesep' option as full
|
|
|
|
path(s).
|
|
|
|
|
|
|
|
fx
|
|
|
|
|
|
|
|
Selected file(s) (i.e. 'fs') if there are any selected files, otherwise
|
|
|
|
current file selection (i.e. 'f').
|
|
|
|
|
|
|
|
id
|
|
|
|
|
|
|
|
Id of the running client.
|
|
|
|
|
2021-03-19 11:00:00 +00:00
|
|
|
PWD
|
|
|
|
|
|
|
|
Present working directory.
|
|
|
|
|
2021-04-13 20:48:49 +00:00
|
|
|
OLDPWD
|
|
|
|
|
|
|
|
Initial working directory.
|
|
|
|
|
2020-10-02 20:37:39 +00:00
|
|
|
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 '[ -n "$LF_LEVEL" ] &&
|
|
|
|
PS1="$PS1""(lf level: $LF_LEVEL) "' in your shell configuration file (e.g.
|
|
|
|
'~/.bashrc').
|
|
|
|
|
|
|
|
OPENER
|
|
|
|
|
|
|
|
If this variable is set in the environment, use the same value, otherwise
|
|
|
|
set the value to 'start' in Windows, 'open' in MacOS, 'xdg-open' in others.
|
|
|
|
|
|
|
|
EDITOR
|
|
|
|
|
|
|
|
If this variable is set in the environment, use the same value, otherwise
|
|
|
|
set the value to 'vi' on unix, 'notepad' in Windows.
|
|
|
|
|
|
|
|
PAGER
|
|
|
|
|
|
|
|
If this variable is set in the environment, use the same value, otherwise
|
|
|
|
set the value to 'less' on unix, 'more' in Windows.
|
|
|
|
|
|
|
|
SHELL
|
|
|
|
|
|
|
|
If this variable is set in the environment, use the same value, otherwise
|
|
|
|
set the value to 'sh' on unix, 'cmd' in Windows.
|
|
|
|
|
|
|
|
|
2016-09-14 23:18:50 +00:00
|
|
|
Prefixes
|
|
|
|
|
|
|
|
The following command prefixes are used by lf:
|
|
|
|
|
2018-03-27 18:23:34 +00:00
|
|
|
: read (default) builtin/custom command
|
|
|
|
$ shell shell command
|
2018-04-06 19:49:50 +00:00
|
|
|
% shell-pipe shell command running with the ui
|
2018-03-27 18:23:34 +00:00
|
|
|
! shell-wait shell command waiting for key press
|
2018-04-06 19:49:50 +00:00
|
|
|
& shell-async shell command running asynchronously
|
2016-09-14 23:18:50 +00:00
|
|
|
|
2018-05-20 17:30:41 +00:00
|
|
|
The same evaluator is used for the command line and the configuration file
|
|
|
|
for read and 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
|
2019-05-14 17:27:16 +00:00
|
|
|
default.
|
2016-09-14 23:18:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
Syntax
|
|
|
|
|
2017-09-08 20:47:37 +00:00
|
|
|
Characters from '#' to newline are comments and ignored:
|
2016-12-19 21:19:07 +00:00
|
|
|
|
|
|
|
# comments start with '#'
|
2016-09-14 23:18:50 +00:00
|
|
|
|
2017-09-08 20:47:37 +00:00
|
|
|
There are three special commands ('set', 'map', and 'cmd') and their
|
2017-03-10 15:53:21 +00:00
|
|
|
variants for configuration.
|
2016-09-14 23:18:50 +00:00
|
|
|
|
2018-07-05 20:09:53 +00:00
|
|
|
Command 'set' is used to set an option which can be boolean, integer, or
|
|
|
|
string:
|
2016-12-19 21:19:07 +00:00
|
|
|
|
2017-03-10 15:53:21 +00:00
|
|
|
set hidden # boolean on
|
|
|
|
set nohidden # boolean off
|
|
|
|
set hidden! # boolean toggle
|
|
|
|
set scrolloff 10 # integer value
|
|
|
|
set sortby time # string value w/o quotes
|
|
|
|
set sortby 'time' # string value with single quotes (whitespaces)
|
|
|
|
set sortby "time" # string value with double quotes (backslash escapes)
|
2016-12-19 21:19:07 +00:00
|
|
|
|
2018-07-05 20:09:53 +00:00
|
|
|
Command 'map' is used to bind a key to a command which can be builtin
|
|
|
|
command, custom command, or shell command:
|
2016-12-19 21:19:07 +00:00
|
|
|
|
2017-09-08 20:46:31 +00:00
|
|
|
map gh cd ~ # builtin command
|
2017-03-10 15:53:21 +00:00
|
|
|
map D trash # custom command
|
2017-09-08 20:47:37 +00:00
|
|
|
map i $less $f # shell command
|
2021-05-19 19:25:26 +00:00
|
|
|
map U !du -csh * # waiting shell command
|
2017-03-10 15:53:21 +00:00
|
|
|
|
2018-07-05 20:09:53 +00:00
|
|
|
Command 'cmap' is used to bind a key to a command line command which can
|
|
|
|
only be one of the builtin commands:
|
2017-03-10 15:53:21 +00:00
|
|
|
|
|
|
|
cmap <c-g> cmd-escape
|
2016-12-19 21:19:07 +00:00
|
|
|
|
|
|
|
You can delete an existing binding by leaving the expression empty:
|
2016-09-14 23:18:50 +00:00
|
|
|
|
2017-03-10 15:53:21 +00:00
|
|
|
map gh # deletes 'gh' mapping
|
|
|
|
cmap <c-g> # deletes '<c-g>' mapping
|
2016-09-14 23:18:50 +00:00
|
|
|
|
2018-07-05 20:09:53 +00:00
|
|
|
Command 'cmd' is used to define a custom command:
|
2016-09-14 23:18:50 +00:00
|
|
|
|
2018-06-15 21:57:50 +00:00
|
|
|
cmd usage $du -h -d1 | less
|
2016-12-19 21:19:07 +00:00
|
|
|
|
|
|
|
You can delete an existing command by leaving the expression empty:
|
|
|
|
|
2017-09-08 20:47:37 +00:00
|
|
|
cmd trash # deletes 'trash' command
|
2016-12-19 21:19:07 +00:00
|
|
|
|
2017-09-08 20:47:37 +00:00
|
|
|
If there is no prefix then ':' is assumed:
|
2016-12-19 21:19:07 +00:00
|
|
|
|
2017-02-04 18:33:36 +00:00
|
|
|
map zt set info time
|
2016-12-19 21:19:07 +00:00
|
|
|
|
2017-09-08 20:47:37 +00:00
|
|
|
An explicit ':' can be provided to group statements until a newline which is
|
|
|
|
especially useful for 'map' and 'cmd' commands:
|
2016-12-19 21:19:07 +00:00
|
|
|
|
2017-02-04 18:33:36 +00:00
|
|
|
map st :set sortby time; set info time
|
2016-12-19 21:19:07 +00:00
|
|
|
|
2017-09-08 20:47:37 +00:00
|
|
|
If you need multiline you can wrap statements in '{{' and '}}' after the
|
2016-12-19 21:19:07 +00:00
|
|
|
proper prefix.
|
|
|
|
|
|
|
|
map st :{{
|
2017-03-10 13:15:16 +00:00
|
|
|
set sortby time
|
|
|
|
set info time
|
2016-12-19 21:19:07 +00:00
|
|
|
}}
|
2016-09-14 23:18:50 +00:00
|
|
|
|
|
|
|
|
2018-06-06 18:39:44 +00:00
|
|
|
Key Mappings
|
|
|
|
|
|
|
|
Regular keys are assigned to a command with the usual syntax:
|
|
|
|
|
|
|
|
map a down
|
|
|
|
|
|
|
|
Keys combined with the shift key simply use the uppercase letter:
|
|
|
|
|
|
|
|
map A down
|
|
|
|
|
|
|
|
Special keys are written in between '<' and '>' characters and always use
|
|
|
|
lowercase letters:
|
|
|
|
|
|
|
|
map <enter> down
|
|
|
|
|
|
|
|
Angle brackets can be assigned with their special names:
|
|
|
|
|
|
|
|
map <lt> down
|
|
|
|
map <gt> down
|
|
|
|
|
|
|
|
Function keys are prefixed with 'f' character:
|
|
|
|
|
|
|
|
map <f-1> down
|
|
|
|
|
|
|
|
Keys combined with the control key are prefixed with 'c' character:
|
|
|
|
|
|
|
|
map <c-a> down
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
|
|
|
map á down
|
|
|
|
|
|
|
|
Newer terminals (e.g. gnome-terminal) may prefix the key with an escape key
|
2018-06-06 18:50:15 +00:00
|
|
|
when the alt key is pressed. lf uses the escape delaying mechanism to
|
2018-06-06 18:39:44 +00:00
|
|
|
recognize alt keys in these terminals (delay is 100ms). On these terminals,
|
|
|
|
keys combined with the alt key are prefixed with 'a' character:
|
|
|
|
|
|
|
|
map <a-a> down
|
|
|
|
|
|
|
|
Please note that, some key combinations are not possible due to the way
|
2018-06-06 18:50:15 +00:00
|
|
|
terminals work (e.g. control and h combination sends a backspace key
|
|
|
|
instead). The easiest way to find the name of a key combination is to press
|
|
|
|
the key while lf is running and read the name of the key from the unknown
|
|
|
|
mapping error.
|
2018-06-06 18:39:44 +00:00
|
|
|
|
2021-01-18 22:20:05 +00:00
|
|
|
Mouse buttons are prefixed with 'm' character:
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
Mouse wheel events are also prefixed with 'm' character:
|
|
|
|
|
|
|
|
map <m-up> down
|
|
|
|
map <m-down> down
|
|
|
|
map <m-left> down
|
|
|
|
map <m-right> down
|
|
|
|
|
2018-06-06 18:39:44 +00:00
|
|
|
|
2018-04-06 19:49:50 +00:00
|
|
|
Push Mappings
|
2016-09-18 16:21:24 +00:00
|
|
|
|
|
|
|
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 builtin keys as well as
|
2017-09-08 20:47:37 +00:00
|
|
|
other commands, it can be limiting at times. For this reason 'push' command
|
2016-09-18 16:21:24 +00:00
|
|
|
is provided by lf. This command is used to simulate key pushes given as its
|
2017-09-08 20:47:37 +00:00
|
|
|
arguments. You can 'map' a key to a 'push' command with an argument to
|
2016-09-18 16:21:24 +00:00
|
|
|
create various keybindings.
|
|
|
|
|
|
|
|
This is mainly useful for two purposes. First, it can be used to map a
|
2016-12-19 21:19:07 +00:00
|
|
|
command with a command count:
|
2016-09-18 16:21:24 +00:00
|
|
|
|
|
|
|
map <c-j> push 10j
|
|
|
|
|
|
|
|
Second, it can be used to avoid typing the name when a command takes
|
2016-12-19 21:19:07 +00:00
|
|
|
arguments:
|
2016-09-18 16:21:24 +00:00
|
|
|
|
2016-10-15 18:46:31 +00:00
|
|
|
map r push :rename<space>
|
2016-09-18 16:21:24 +00:00
|
|
|
|
2017-09-08 20:47:37 +00:00
|
|
|
One thing to be careful is that since 'push' command works with keys instead
|
2016-12-19 21:19:07 +00:00
|
|
|
of commands it is possible to accidentally create recursive bindings:
|
2016-09-18 16:21:24 +00:00
|
|
|
|
|
|
|
map j push 2j
|
|
|
|
|
|
|
|
These types of bindings create a deadlock when executed.
|
|
|
|
|
2018-04-06 19:52:15 +00:00
|
|
|
|
|
|
|
Shell Commands
|
2016-09-18 16:21:24 +00:00
|
|
|
|
2018-04-06 19:49:50 +00:00
|
|
|
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 selected
|
|
|
|
file(s) to trash. A first attempt to write such a command may look like
|
|
|
|
this:
|
2016-09-14 23:18:50 +00:00
|
|
|
|
|
|
|
cmd trash ${{
|
2017-03-10 13:15:16 +00:00
|
|
|
mkdir -p ~/.trash
|
2017-09-07 20:01:57 +00:00
|
|
|
if [ -z "$fs" ]; then
|
2017-09-16 19:11:43 +00:00
|
|
|
mv "$f" ~/.trash
|
2017-03-10 13:15:16 +00:00
|
|
|
else
|
2017-09-16 19:11:43 +00:00
|
|
|
IFS="'printf '\n\t''"; mv $fs ~/.trash
|
2017-03-10 13:15:16 +00:00
|
|
|
fi
|
2016-09-14 23:18:50 +00:00
|
|
|
}}
|
|
|
|
|
2018-07-09 18:22:10 +00:00
|
|
|
We check '$fs' to see if there are any selected files. Otherwise we just
|
2016-09-14 23:18:50 +00:00
|
|
|
delete the current file. Since this is such a common pattern, a separate
|
2017-09-08 20:47:37 +00:00
|
|
|
'$fx' variable is provided. We can use this variable to get rid of the
|
2016-12-19 21:19:07 +00:00
|
|
|
conditional:
|
2016-09-14 23:18:50 +00:00
|
|
|
|
|
|
|
cmd trash ${{
|
2017-03-10 13:15:16 +00:00
|
|
|
mkdir -p ~/.trash
|
2017-09-16 19:11:43 +00:00
|
|
|
IFS="'printf '\n\t''"; mv $fx ~/.trash
|
2016-09-14 23:18:50 +00:00
|
|
|
}}
|
|
|
|
|
|
|
|
The trash directory is checked each time the command is executed. We can
|
2016-12-19 21:19:07 +00:00
|
|
|
move it outside of the command so it would only run once at startup:
|
2016-09-14 23:18:50 +00:00
|
|
|
|
|
|
|
${{ mkdir -p ~/.trash }}
|
|
|
|
|
2017-09-16 19:11:43 +00:00
|
|
|
cmd trash ${{ IFS="'printf '\n\t''"; mv $fx ~/.trash }}
|
2016-09-14 23:18:50 +00:00
|
|
|
|
2017-09-08 20:47:37 +00:00
|
|
|
Since these are one liners, we can drop '{{' and '}}':
|
2016-09-14 23:18:50 +00:00
|
|
|
|
|
|
|
$mkdir -p ~/.trash
|
|
|
|
|
2017-09-16 19:11:43 +00:00
|
|
|
cmd trash $IFS="'printf '\n\t''"; mv $fx ~/.trash
|
2016-09-14 23:18:50 +00:00
|
|
|
|
2017-09-08 20:47:37 +00:00
|
|
|
Finally note that we set 'IFS' variable manually in these commands. Instead
|
|
|
|
we could use the 'ifs' option to set it for all shell commands (i.e. 'set
|
|
|
|
ifs "\n"'). This can be especially useful for interactive use (e.g. '$rm $f'
|
|
|
|
or '$rm $fs' would simply work). This option is not set by default as it can
|
2017-09-07 20:01:57 +00:00
|
|
|
behave unexpectedly for new users. However, use of this option is highly
|
|
|
|
recommended and it is assumed in the rest of the documentation.
|
2016-09-14 23:18:50 +00:00
|
|
|
|
2018-04-06 19:52:15 +00:00
|
|
|
|
|
|
|
Piping Shell Commands
|
2018-04-06 19:49:50 +00:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
Instead of pausing the ui, piping shell commands connects stdin, stdout, and
|
|
|
|
stderr of the command to the statline in 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.
|
|
|
|
|
|
|
|
For example, following rename command prompts for overwrite in the statline
|
|
|
|
if there is an existing file with the given name:
|
|
|
|
|
|
|
|
cmd rename %mv -i $f $1
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
|
|
|
cmd rename %[ -e $1 ] && printf "file exists" || mv $f $1
|
|
|
|
|
2020-12-19 14:25:44 +00:00
|
|
|
Note that input is line buffered and output and error are byte buffered.
|
2018-04-06 19:49:50 +00:00
|
|
|
|
2018-04-06 19:52:15 +00:00
|
|
|
|
|
|
|
Waiting Shell Commands
|
2018-04-06 19:49:50 +00:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
2018-04-06 19:52:15 +00:00
|
|
|
|
|
|
|
Asynchronous Shell Commands
|
2018-04-06 19:49:50 +00:00
|
|
|
|
|
|
|
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 is neither connected to the terminal nor
|
|
|
|
to the ui.
|
|
|
|
|
2016-09-14 23:18:50 +00:00
|
|
|
|
2017-02-11 13:14:41 +00:00
|
|
|
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.
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
|
|
|
echo 'send echo hello world' | nc -U /tmp/lf.${USER}.sock
|
|
|
|
|
2017-02-11 13:34:48 +00:00
|
|
|
Since such a client may not be available everywhere, lf comes bundled with a
|
2017-02-11 13:14:41 +00:00
|
|
|
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:
|
|
|
|
|
|
|
|
lf -remote 'send echo hello world'
|
|
|
|
|
2017-09-08 20:47:37 +00:00
|
|
|
In this command 'send' is used to send the rest of the string as a command
|
2017-02-11 13:14:41 +00:00
|
|
|
to all connected clients. You can optionally give it an id number to send a
|
|
|
|
command to a single client:
|
|
|
|
|
2021-05-19 19:25:26 +00:00
|
|
|
lf -remote 'send 1234 echo hello world'
|
2017-02-11 13:14:41 +00:00
|
|
|
|
|
|
|
All clients have a unique id number but you may not be aware of the id
|
2017-09-08 20:47:37 +00:00
|
|
|
number when you are writing a command. For this purpose, an '$id' variable
|
2021-05-19 19:25:26 +00:00
|
|
|
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
|
2017-02-11 13:14:41 +00:00
|
|
|
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:
|
|
|
|
|
|
|
|
lf -remote "send $id echo hello world"
|
|
|
|
|
2017-09-08 20:46:31 +00:00
|
|
|
Since lf does not have control flow syntax, remote commands are used for
|
2018-04-06 19:49:50 +00:00
|
|
|
such needs. For example, you can configure the number of columns in the ui
|
|
|
|
with respect to the terminal width as follows:
|
|
|
|
|
2018-06-15 21:57:50 +00:00
|
|
|
cmd recol %{{
|
2018-04-06 19:49:50 +00:00
|
|
|
w=$(tput cols)
|
|
|
|
if [ $w -le 80 ]; then
|
|
|
|
lf -remote "send $id set ratios 1:2"
|
|
|
|
elif [ $w -le 160 ]; then
|
|
|
|
lf -remote "send $id set ratios 1:2:3"
|
2017-03-10 13:15:16 +00:00
|
|
|
else
|
2018-04-06 19:49:50 +00:00
|
|
|
lf -remote "send $id set ratios 1:2:3:5"
|
2017-03-10 13:15:16 +00:00
|
|
|
fi
|
2017-02-11 13:14:41 +00:00
|
|
|
}}
|
|
|
|
|
2021-05-19 19:25:26 +00:00
|
|
|
Besides 'send' command, there is a 'quit' command to quit the server when
|
|
|
|
there are no connected clients left, and a 'quit!' command to force quit the
|
|
|
|
server by closing client connections first:
|
2018-07-22 17:44:56 +00:00
|
|
|
|
|
|
|
lf -remote 'quit'
|
2021-05-19 19:25:26 +00:00
|
|
|
lf -remote 'quit!'
|
2018-07-22 17:44:56 +00:00
|
|
|
|
2017-09-08 20:47:37 +00:00
|
|
|
Lastly, there is a 'conn' command to connect the server as a client. This
|
2017-02-11 13:14:41 +00:00
|
|
|
should not be needed for users.
|
|
|
|
|
|
|
|
|
2016-09-15 14:08:05 +00:00
|
|
|
File Operations
|
|
|
|
|
2019-03-03 19:12:33 +00:00
|
|
|
lf uses its own builtin 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 '--backup=numbered'
|
|
|
|
option in GNU cp is added to the new files or directories. Only file modes
|
|
|
|
are preserved and all other attributes are ignored including ownership,
|
2021-02-12 17:54:18 +00:00
|
|
|
timestamps, context, and xattr. Special files such as character and block
|
|
|
|
devices, named pipes, and sockets are skipped and links are not followed.
|
2020-07-25 21:29:50 +00:00
|
|
|
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
|
2019-03-03 19:12:33 +00:00
|
|
|
as well as the log file and they do not preemptively finish the
|
|
|
|
corresponding file operation.
|
|
|
|
|
|
|
|
File operations can be performed on the current selected file or
|
2019-03-13 19:28:20 +00:00
|
|
|
alternatively on multiple files by selecting them first. When you 'copy' a
|
2019-03-03 19:12:33 +00:00
|
|
|
file, lf doesn't actually copy the file on the disk, but only records its
|
2021-05-19 19:25:26 +00:00
|
|
|
name to a file. The actual file copying takes place when you 'paste'.
|
2019-03-03 19:12:33 +00:00
|
|
|
Similarly 'paste' after a 'cut' operation moves the file.
|
|
|
|
|
|
|
|
You can customize copy and move operations by defining a 'paste' command.
|
|
|
|
This is a special command that is called when it is defined instead of the
|
|
|
|
builtin implementation. You can use the following example as a starting
|
|
|
|
point:
|
2017-09-17 16:36:37 +00:00
|
|
|
|
2022-01-04 20:48:04 +00:00
|
|
|
cmd paste %{{
|
|
|
|
load=$(cat ~/.local/share/lf/files)
|
|
|
|
mode=$(echo "$load" | sed -n '1p')
|
|
|
|
list=$(echo "$load" | sed '1d')
|
|
|
|
if [ $mode = 'copy' ]; then
|
|
|
|
cp -R $list .
|
|
|
|
elif [ $mode = 'move' ]; then
|
|
|
|
mv $list .
|
2022-02-04 16:21:03 +00:00
|
|
|
rm ~/.local/share/lf/files
|
|
|
|
lf -remote 'send clear'
|
2022-01-04 20:48:04 +00:00
|
|
|
fi
|
|
|
|
}}
|
2017-09-17 16:36:37 +00:00
|
|
|
|
2019-03-03 19:12:33 +00:00
|
|
|
Some useful things to be considered are to use the backup ('--backup')
|
|
|
|
and/or preserve attributes ('-a') options with 'cp' and 'mv' commands if
|
|
|
|
they support it (i.e. GNU implementation), change the command type to
|
|
|
|
asynchronous, or use 'rsync' command with progress bar option for copying
|
|
|
|
and feed the progress to the client periodically with remote 'echo' calls.
|
2017-09-17 16:36:37 +00:00
|
|
|
|
2019-01-31 19:15:31 +00:00
|
|
|
By default, lf does not assign 'delete' command to a key to protect new
|
|
|
|
users. You can customize file deletion by defining a 'delete' 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 are provided in the example configuration file.
|
2017-02-11 13:28:45 +00:00
|
|
|
|
2016-09-15 14:08:05 +00:00
|
|
|
|
2019-01-18 17:41:17 +00:00
|
|
|
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.
|
|
|
|
|
|
|
|
Searching mechanism is implemented with commands 'search' (default '/'),
|
|
|
|
'search-back' (default '?'), 'search-next' (default 'n'), and 'search-prev'
|
|
|
|
(default 'N'). You can enable 'globsearch' option to match with a glob
|
|
|
|
pattern. Globbing supports '*' to match any sequence, '?' to match any
|
|
|
|
character, and '[...]' or '[^...] to match character sets or ranges. You can
|
|
|
|
enable 'incsearch' option to jump to the current match at each keystroke
|
|
|
|
while typing. In this mode, you can either use 'cmd-enter' to accept the
|
2019-05-14 17:27:16 +00:00
|
|
|
search or use 'cmd-escape' to cancel the search. Alternatively, you can also
|
|
|
|
map some other commands with 'cmap' to accept the search and execute the
|
|
|
|
command immediately afterwards. Possible candidates are 'up', 'down' and
|
2021-01-18 22:45:42 +00:00
|
|
|
their variants, 'top', 'bottom', 'updir', and 'open' commands. For example,
|
|
|
|
you can use arrow keys to finish the search with the following mappings:
|
2019-05-14 17:27:16 +00:00
|
|
|
|
2021-01-18 22:45:42 +00:00
|
|
|
cmap <up> up
|
|
|
|
cmap <down> down
|
|
|
|
cmap <left> updir
|
2019-05-14 17:27:16 +00:00
|
|
|
cmap <right> open
|
2019-01-18 17:41:17 +00:00
|
|
|
|
|
|
|
Finding mechanism is implemented with commands 'find' (default 'f'),
|
|
|
|
'find-back' (default 'F'), 'find-next' (default ';'), 'find-prev' (default
|
|
|
|
','). You can disable 'anchorfind' 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 'findlen' option. If you set this value to zero, then
|
|
|
|
the the keys are read until there is only a single match. Default values of
|
|
|
|
these two options are set to jump to the first file with the given initial.
|
|
|
|
|
|
|
|
Some options effect both searching and finding. You can disable 'wrapscan'
|
|
|
|
option to prevent searches to wrap around at the end of the file list. You
|
|
|
|
can disable 'ignorecase' 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 'smartcase' option to
|
|
|
|
disable this behavior. Two similar options 'ignoredia' and 'smartdia' are
|
|
|
|
provided to control matching diacritics in latin letters.
|
|
|
|
|
|
|
|
|
2016-09-14 23:18:50 +00:00
|
|
|
Opening Files
|
|
|
|
|
2019-01-18 20:09:18 +00:00
|
|
|
You can define a an 'open' command (default 'l' and '<right>') 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:
|
2016-09-14 23:18:50 +00:00
|
|
|
|
2018-06-28 18:20:43 +00:00
|
|
|
cmd open $vi $fx
|
2016-09-14 23:18:50 +00:00
|
|
|
|
2016-12-19 21:19:07 +00:00
|
|
|
It is possible to use different command types:
|
2016-09-14 23:18:50 +00:00
|
|
|
|
2018-06-28 18:20:43 +00:00
|
|
|
cmd open &xdg-open $f
|
2016-09-14 23:18:50 +00:00
|
|
|
|
2017-09-08 20:47:37 +00:00
|
|
|
You may want to use either file extensions or mime types from 'file'
|
2016-12-19 21:19:07 +00:00
|
|
|
command:
|
2016-09-14 23:18:50 +00:00
|
|
|
|
2018-06-28 18:20:43 +00:00
|
|
|
cmd open ${{
|
2021-05-21 22:46:13 +00:00
|
|
|
test -L $f && f=$(readlink -f $f)
|
2017-09-07 20:01:57 +00:00
|
|
|
case $(file --mime-type $f -b) in
|
2017-09-08 20:47:37 +00:00
|
|
|
text/*) vi $fx;;
|
2017-09-07 20:01:57 +00:00
|
|
|
*) for f in $fx; do xdg-open $f > /dev/null 2> /dev/null & done;;
|
2017-03-10 13:15:16 +00:00
|
|
|
esac
|
2016-09-14 23:18:50 +00:00
|
|
|
}}
|
|
|
|
|
2019-10-07 17:23:08 +00:00
|
|
|
You may want to use 'setsid' before your opener command to have persistent
|
|
|
|
processes that continue to run after lf quits.
|
|
|
|
|
2018-06-28 20:37:01 +00:00
|
|
|
Following command is provided by default:
|
2018-03-02 20:15:36 +00:00
|
|
|
|
2018-06-28 21:34:21 +00:00
|
|
|
cmd open &$OPENER $f
|
2018-03-02 20:15:36 +00:00
|
|
|
|
|
|
|
You may also use any other existing file openers as you like. Possible
|
|
|
|
options are 'libfile-mimeinfo-perl' (executable name is 'mimeopen'), 'rifle'
|
|
|
|
(ranger's default file opener), or 'mimeo' to name a few.
|
2016-09-15 18:44:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
Previewing Files
|
|
|
|
|
|
|
|
lf previews files on the preview pane by printing the file until the end or
|
|
|
|
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 as text to
|
|
|
|
name few. For coloring lf recognizes ansi escape codes.
|
|
|
|
|
2017-09-08 20:47:37 +00:00
|
|
|
In order to use this feature you need to set the value of 'previewer' option
|
2016-09-15 18:44:06 +00:00
|
|
|
to the path of an executable file. lf passes the current file name as the
|
|
|
|
first argument and the height of the preview pane as the second argument
|
|
|
|
when running this file. Output of the execution is printed in the preview
|
|
|
|
pane. You may want to use the same script in your pager mapping as well if
|
2016-12-19 21:19:07 +00:00
|
|
|
any:
|
2016-09-15 18:44:06 +00:00
|
|
|
|
|
|
|
set previewer ~/.config/lf/pv.sh
|
2017-09-07 20:01:57 +00:00
|
|
|
map i $~/.config/lf/pv.sh $f | less -R
|
2016-09-15 18:44:06 +00:00
|
|
|
|
2020-12-11 14:07:34 +00:00
|
|
|
For 'less' pager, you may instead utilize 'LESSOPEN' mechanism so that
|
|
|
|
useful information about the file such as the full path of the file can be
|
|
|
|
displayed in the statusline below:
|
|
|
|
|
|
|
|
set previewer ~/.config/lf/pv.sh
|
|
|
|
map i $LESSOPEN='| ~/.config/lf/pv.sh %s' less -R $f
|
|
|
|
|
2016-09-15 18:44:06 +00:00
|
|
|
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
|
2017-09-08 20:47:37 +00:00
|
|
|
to obtaining mime types from 'file' command. Extensions can then be used to
|
2016-12-19 21:19:07 +00:00
|
|
|
match cleanly within a conditional:
|
2016-09-15 18:44:06 +00:00
|
|
|
|
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
case "$1" in
|
2017-03-10 13:15:16 +00:00
|
|
|
*.tar*) tar tf "$1";;
|
|
|
|
*.zip) unzip -l "$1";;
|
|
|
|
*.rar) unrar l "$1";;
|
|
|
|
*.7z) 7z l "$1";;
|
|
|
|
*.pdf) pdftotext "$1" -;;
|
2021-02-05 21:19:09 +00:00
|
|
|
*) highlight -O ansi "$1";;
|
2016-09-15 18:44:06 +00:00
|
|
|
esac
|
|
|
|
|
|
|
|
Another important consideration for efficiency is the use of programs with
|
2017-09-08 20:47:37 +00:00
|
|
|
short startup times for preview. For this reason, 'highlight' is recommended
|
|
|
|
over 'pygmentize' for syntax highlighting. Besides, it is also important
|
2016-09-15 18:44:06 +00:00
|
|
|
that the application is processing the file on the fly rather than first
|
|
|
|
reading it to the memory and then do 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
|
2021-01-18 20:44:26 +00:00
|
|
|
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
|
2021-02-05 21:19:09 +00:00
|
|
|
and avoid caching. You may add a trailing '|| true' command to avoid such
|
|
|
|
errors:
|
2021-01-18 20:44:26 +00:00
|
|
|
|
2021-02-05 21:19:09 +00:00
|
|
|
highlight -O ansi "$1" || true
|
2018-04-20 21:11:54 +00:00
|
|
|
|
2020-12-11 14:07:34 +00:00
|
|
|
You may also use an existing preview filter as you like. Your system may
|
|
|
|
already come with a preview filter named 'lesspipe'. These filters may have
|
|
|
|
a mechanism to add user customizations as well. See the related
|
|
|
|
documentations for more information.
|
|
|
|
|
2018-04-20 21:11:54 +00:00
|
|
|
|
2020-04-13 14:58:03 +00:00
|
|
|
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 wrapper shell scripts provided in the
|
|
|
|
repository.
|
|
|
|
|
|
|
|
There is a special command 'on-cd' 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:
|
|
|
|
|
|
|
|
cmd on-cd &{{
|
|
|
|
# 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 " (%s)") || true
|
2021-01-10 21:40:14 +00:00
|
|
|
fmt="\033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f$git\033[0m"
|
2020-04-13 14:58:03 +00:00
|
|
|
lf -remote "send $id set promptfmt \"$fmt\""
|
|
|
|
}}
|
|
|
|
|
2021-01-24 13:33:49 +00:00
|
|
|
If you want to print escape sequences, you may redirect 'printf' output to
|
|
|
|
'/dev/tty'. The following xterm specific escape sequence sets the terminal
|
|
|
|
title to the working directory:
|
|
|
|
|
|
|
|
cmd on-cd &{{
|
|
|
|
printf "\033]0; $PWD\007" > /dev/tty
|
|
|
|
}}
|
|
|
|
|
2020-04-13 14:58:03 +00:00
|
|
|
This command runs whenever you change directory but not on startup. You can
|
|
|
|
add an extra call to make it run on startup as well:
|
|
|
|
|
|
|
|
cmd on-cd &{{ # ... }}
|
|
|
|
on-cd
|
|
|
|
|
|
|
|
Note that all shell commands are possible but '%' and '&' are usually more
|
|
|
|
appropriate as '$' and '!' causes flickers and pauses respectively.
|
|
|
|
|
2021-08-23 14:11:56 +00:00
|
|
|
There is also a 'pre-cd' command, that works like 'on-cd', but is run before
|
|
|
|
the directory is actually changed. It is generally a bad idea, to put
|
|
|
|
movement commands (like 'up' / 'top' etc.) here.
|
|
|
|
|
2020-04-13 14:58:03 +00:00
|
|
|
|
2020-12-27 00:27:33 +00:00
|
|
|
Colors
|
|
|
|
|
|
|
|
lf tries to automatically adapt its colors to the environment. It starts
|
|
|
|
with a default colorscheme and updates colors using values of existing
|
|
|
|
environment variables possibly by overwriting its previous values. Colors
|
|
|
|
are set in the following order:
|
|
|
|
|
|
|
|
1. default
|
|
|
|
2. LSCOLORS (Mac/BSD ls)
|
|
|
|
3. LS_COLORS (GNU ls)
|
|
|
|
4. LF_COLORS (lf specific)
|
|
|
|
|
|
|
|
Please refer to the corresponding man pages for more information about
|
|
|
|
'LSCOLORS' and 'LS_COLORS'. 'LF_COLORS' is provided with the same syntax as
|
|
|
|
'LS_COLORS' 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.
|
|
|
|
|
|
|
|
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.
|
2018-04-20 21:11:54 +00:00
|
|
|
|
2020-12-27 00:27:33 +00:00
|
|
|
Second, you can set the values of environmental variables mentioned above
|
|
|
|
for fine grained customization. Note that 'LS_COLORS/LF_COLORS' are more
|
|
|
|
powerful than 'LSCOLORS' 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 best results.
|
2018-04-20 21:11:54 +00:00
|
|
|
|
2020-12-27 00:27:33 +00:00
|
|
|
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 'promptfmt' 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.
|
2018-04-20 21:11:54 +00:00
|
|
|
|
2020-09-01 12:42:44 +00:00
|
|
|
It is worth noting that lf uses as many colors are advertised by your
|
|
|
|
terminal's entry in your systems terminfo or infocmp database, if this is
|
|
|
|
not present lf will default to an internal database. For terminals
|
|
|
|
supporting 24-bit (or "true") color that do not have a database entry (or
|
|
|
|
one that does not advertise all capabilities), support can be enabled by
|
|
|
|
either setting the '$COLORTERM' variable to "truecolor" or ensuring '$TERM'
|
|
|
|
is set to a value that ends with "-truecolor".
|
2019-01-08 19:47:41 +00:00
|
|
|
|
2020-12-27 00:27:33 +00:00
|
|
|
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:
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
|
|
|
1. Full Path (e.g. '~/.config/lf/lfrc')
|
|
|
|
2. Dir Name (e.g. '.git/') (only matches dirs with a trailing slash at the end)
|
2021-01-02 22:02:40 +00:00
|
|
|
3. File Type (e.g. 'ln') (except 'fi')
|
2021-01-06 22:17:56 +00:00
|
|
|
4. File Name (e.g. '.git*') (only matches files with a trailing star at the end)
|
2021-01-02 22:02:40 +00:00
|
|
|
5. Base Name (e.g. 'README.*')
|
|
|
|
6. Extension (e.g. '*.txt')
|
|
|
|
7. Default (i.e. 'fi')
|
2020-12-27 00:27:33 +00:00
|
|
|
|
|
|
|
For example, given a regular text file '/path/to/README.txt', the following
|
|
|
|
entries are checked in the configuration and the first one to match is used:
|
|
|
|
|
|
|
|
1. '/path/to/README.txt'
|
2021-01-02 22:02:40 +00:00
|
|
|
2. (skipped since the file is not a directory)
|
|
|
|
3. (skipped since the file is of type 'fi')
|
2021-01-06 22:17:56 +00:00
|
|
|
4. 'README.txt*'
|
2021-01-02 22:02:40 +00:00
|
|
|
5. 'README.*'
|
|
|
|
6. '*.txt'
|
|
|
|
7. 'fi'
|
|
|
|
|
|
|
|
Given a regular directory '/path/to/example.d', the following entries are
|
|
|
|
checked in the configuration and the first one to match is used:
|
|
|
|
|
|
|
|
1. '/path/to/example.d'
|
|
|
|
2. 'example.d/'
|
|
|
|
3. 'di'
|
2021-01-06 22:17:56 +00:00
|
|
|
4. 'example.d*'
|
2021-01-02 22:02:40 +00:00
|
|
|
5. 'example.*'
|
|
|
|
6. '*.d'
|
|
|
|
7. 'fi'
|
2020-12-27 00:27:33 +00:00
|
|
|
|
|
|
|
Note that glob-like patterns do not actually perform glob matching due to
|
|
|
|
performance reasons.
|
|
|
|
|
|
|
|
For example, you can set a variable as follows:
|
|
|
|
|
|
|
|
export LF_COLORS="~/Documents=01;31:~/Downloads=01;31:~/.local/share=01;31:~/.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:"
|
|
|
|
|
|
|
|
Having all entries on a single line can make it hard to read. You may
|
|
|
|
instead divide it to multiple lines in between double quotes by escaping
|
|
|
|
newlines with backslashes as follows:
|
|
|
|
|
|
|
|
export LF_COLORS="\
|
|
|
|
~/Documents=01;31:\
|
|
|
|
~/Downloads=01;31:\
|
|
|
|
~/.local/share=01;31:\
|
|
|
|
~/.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:\
|
|
|
|
"
|
|
|
|
|
|
|
|
Having such a long variable definition in a shell configuration file might
|
|
|
|
be undesirable. You may instead put this definition in a separate file and
|
|
|
|
source it in your shell configuration file as follows:
|
|
|
|
|
|
|
|
[ -f "/path/to/colors" ] && source "/path/to/colors"
|
|
|
|
|
|
|
|
See the wiki page for ansi escape codes
|
|
|
|
https://en.wikipedia.org/wiki/ANSI_escape_code.
|
|
|
|
|
|
|
|
|
|
|
|
Icons
|
|
|
|
|
|
|
|
Icons are configured using 'LF_ICONS' environment variable. This variable
|
|
|
|
uses the same syntax as 'LS_COLORS/LF_COLORS'. Instead of colors, you should
|
|
|
|
put a single characters as values of entries. Do not forget to enable
|
|
|
|
'icons' option to see the icons. Default values are as follows given with
|
|
|
|
their matching order in lf:
|
|
|
|
|
|
|
|
ln 🗎
|
|
|
|
or 🗎
|
|
|
|
tw 🗀
|
|
|
|
ow 🗀
|
|
|
|
st 🗀
|
|
|
|
di 🗀
|
|
|
|
pi 🗎
|
|
|
|
so 🗎
|
|
|
|
bd 🗎
|
|
|
|
cd 🗎
|
|
|
|
su 🗎
|
|
|
|
sg 🗎
|
|
|
|
ex 🗎
|
|
|
|
fi 🗎
|
|
|
|
|
|
|
|
See the wiki page for an example icons configuration
|
|
|
|
https://github.com/gokcehan/lf/wiki/Icons.
|
2016-09-15 14:08:05 +00:00
|
|
|
`
|