update doc

This commit is contained in:
Gokcehan 2022-04-02 21:18:05 +03:00
parent 4db1a63b75
commit fe59f0f30c
6 changed files with 324 additions and 432 deletions

View File

@ -40,19 +40,19 @@ See [releases](https://github.com/gokcehan/lf/releases) for pre-built binaries.
Building from the source requires [Go](https://go.dev/).
On unix (Go version < 1.17):
On Unix (Go version < 1.17):
```bash
env CGO_ENABLED=0 GO111MODULE=on go get -u -ldflags="-s -w" github.com/gokcehan/lf
```
On unix (Go version >= 1.17):
On Unix (Go version >= 1.17):
```bash
env CGO_ENABLED=0 go install -ldflags="-s -w" github.com/gokcehan/lf@latest
```
On windows `cmd` (Go version < 1.17):
On Windows `cmd` (Go version < 1.17):
```cmd
set CGO_ENABLED=0
@ -60,14 +60,14 @@ set GO111MODULE=on
go get -u -ldflags="-s -w" github.com/gokcehan/lf
```
On windows `cmd` (Go version >= 1.17):
On Windows `cmd` (Go version >= 1.17):
```cmd
set CGO_ENABLED=0
go install -ldflags="-s -w" github.com/gokcehan/lf@latest
```
On windows `powershell` (Go version < 1.17):
On Windows `powershell` (Go version < 1.17):
```powershell
$env:CGO_ENABLED = '0'
@ -75,7 +75,7 @@ $env:GO111MODULE = 'on'
go get -u -ldflags="-s -w" github.com/gokcehan/lf
```
On windows `powershell` (Go version >= 1.17):
On Windows `powershell` (Go version >= 1.17):
```powershell
$env:CGO_ENABLED = '0'

232
doc.go
View File

@ -4,11 +4,11 @@
/*
lf is a terminal file manager.
Source code can be found in the repository at https://github.com/gokcehan/lf .
Source code can be found in the repository at https://github.com/gokcehan/lf
This documentation can either be read from terminal using 'lf -doc' or online at https://pkg.go.dev/github.com/gokcehan/lf .
This documentation can either be read from terminal using 'lf -doc' or online at https://pkg.go.dev/github.com/gokcehan/lf
You can also use 'doc' command (default '<f-1>') inside lf to view the documentation in a pager.
A man page with the same content is also available in the repository at https://github.com/gokcehan/lf/blob/master/lf.1 .
A man page with the same content is also available in the repository at https://github.com/gokcehan/lf/blob/master/lf.1
You can run 'lf -help' to see descriptions of command line options.
@ -27,6 +27,8 @@ The following commands are provided by lf:
scroll-down (default '<c-e>')
updir (default 'h' and '<left>')
open (default 'l' and '<right>')
jump-next (default ']')
jump-prev (default '[')
top (default 'gg' and '<home>')
bottom (default 'G' and '<end>')
toggle
@ -70,9 +72,9 @@ The following commands are provided by lf:
setfilter
mark-save (modal) (default 'm')
mark-load (modal) (default "'")
mark-remove (modal) (default `"`)
mark-remove (modal) (default '"')
tag
tag-toggle (default t)
tag-toggle (default 't')
The following command line commands are provided by lf:
@ -138,8 +140,8 @@ The following options can be used to customize the behavior of lf:
relativenumber bool (default off)
reverse bool (default off)
scrolloff int (default 0)
shell string (default 'sh' for unix and 'cmd' for windows)
shellflag string (default '-c' for unix and '/c' for windows)
shell string (default 'sh' for Unix and 'cmd' for Windows)
shellflag string (default '-c' for Unix and '/c' for Windows)
shellopts []string (default '')
smartcase bool (default on)
smartdia bool (default off)
@ -180,7 +182,7 @@ The following special shell commands are used to customize the behavior of lf wh
The following commands/keybindings are provided by default:
unix windows
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%
@ -207,42 +209,41 @@ Configuration
Configuration files should be located at:
os system-wide user-specific
unix /etc/lf/lfrc ~/.config/lf/lfrc
windows C:\ProgramData\lf\lfrc C:\Users\<user>\AppData\Local\lf\lfrc
OS system-wide user-specific
Unix /etc/lf/lfrc ~/.config/lf/lfrc
Windows C:\ProgramData\lf\lfrc C:\Users\<user>\AppData\Local\lf\lfrc
Colors file should be located at:
unix ~/.local/share/lf/colors
windows C:\Users\<user>\AppData\Local\lf\colors
Unix ~/.local/share/lf/colors
Windows C:\Users\<user>\AppData\Local\lf\colors
Icons file should be located at:
unix ~/.local/share/lf/icons
windows C:\Users\<user>\AppData\Local\lf\icons
Unix ~/.local/share/lf/icons
Windows C:\Users\<user>\AppData\Local\lf\icons
Selection file should be located at:
unix ~/.local/share/lf/files
windows C:\Users\<user>\AppData\Local\lf\files
Unix ~/.local/share/lf/files
Windows C:\Users\<user>\AppData\Local\lf\files
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
Unix ~/.local/share/lf/marks
Windows C:\Users\<user>\AppData\Local\lf\marks
Tags file should be located at:
unix ~/.local/share/lf/tags
windows C:\Users\<user>\AppData\Local\lf\tags
Unix ~/.local/share/lf/tags
Windows C:\Users\<user>\AppData\Local\lf\tags
You can configure the default values of following variables to change these
locations:
History file should be located at:
Unix ~/.local/share/lf/history
Windows C:\Users\<user>\AppData\Local\lf\history
You can configure the default values of following variables to change these locations:
$XDG_CONFIG_HOME ~/.config
$XDG_DATA_HOME ~/.local/share
@ -250,7 +251,7 @@ locations:
%LOCALAPPDATA% C:\Users\<user>\AppData\Local
A sample configuration file can be found at
https://github.com/gokcehan/lf/blob/master/etc/lfrc.example .
https://github.com/gokcehan/lf/blob/master/etc/lfrc.example
Commands
@ -282,15 +283,10 @@ If the current file is a directory, then change the current directory to it, oth
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)
jump-next (default ']')
jump-prev (default '[')
Change the current working directory to the previous jumplist item.
jump-next (default ']')
Change the current working directory to the next jumplist item.
Change the current working directory to the next/previous jumplist item.
top (default 'gg' and '<home>')
bottom (default 'G' and '<end>')
@ -305,23 +301,21 @@ Toggle the selection of the current file or files given as arguments.
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.
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.
Select/unselect files that match the given glob.
calcdirsize
Get the total size for each of the selected directories.
Calculate the total size for each of the selected directories.
Option 'info' should include 'size' and option 'dircounts' should be disabled to show this size.
copy (default 'y')
@ -334,6 +328,7 @@ If there are no selections, save the path of the current file to the cut buffer,
paste (default 'p')
Copy/Move files in copy/cut buffer to the current working directory.
A custom 'paste' command can be defined to override this default.
clear (default 'c')
@ -372,7 +367,7 @@ 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.
Print given arguments to the message line at the bottom as 'errorfmt' and also to the log file.
cd
@ -385,6 +380,7 @@ Change the current file selection to the given argument.
delete (modal)
Remove the current file or selected file(s).
A custom 'delete' command can be defined to override this default.
rename (modal) (default 'r')
@ -407,20 +403,14 @@ Read a command to evaluate.
Read a shell command to execute.
(See also 'Prefixes' and 'Shell Commands' sections)
shell-pipe (modal) (default '%')
Read a shell command to execute piping its standard I/O to the bottom statline.
(See also 'Prefixes' and 'Piping Shell Commands' sections)
shell-wait (modal) (default '!')
Read a shell command to execute and wait for a key press in the end.
(See also 'Prefixes' and 'Waiting Shell Commands' sections)
shell-async (modal) (default '&')
Read a shell command to execute asynchronously without standard I/O.
@ -432,8 +422,6 @@ Read a shell command to execute asynchronously without standard I/O.
Read key(s) to find the appropriate file name match in the forward/backward direction and jump to the next/previous match.
(See also 'anchorfind', 'findlen', 'wrapscan', 'ignorecase', 'smartcase', 'ignoredia', and 'smartdia' options and 'Searching Files' section)
search (default '/')
search-back (default '?')
search-next (default 'n')
@ -441,16 +429,12 @@ Read key(s) to find the appropriate file name match in the forward/backward dire
Read a pattern to search for a file name match in the forward/backward direction and jump to the next/previous match.
(See also 'globsearch', 'incsearch', 'wrapscan', 'ignorecase', 'smartcase', 'ignoredia', and 'smartdia' options and 'Searching Files' section)
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 immediately.
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)
Command 'filter' reads a pattern to filter out and only view files matching the pattern.
Command 'setfilter' does the same but uses an argument to set the filter immediately.
You can supply an argument to 'filter', in order to use that as the starting prompt.
mark-save (modal) (default 'm')
@ -461,17 +445,17 @@ Save the current directory as a bookmark assigned to the given key.
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.
mark-remove (modal) (default `"`)
mark-remove (modal) (default '"')
Remove a bookmark assigned to the given key.
tag
Tag a file with "*" or a single width character given in the argument.
Tag a file with '*' or a single width character given in the argument.
tag-toggle (default 't')
Tag a file with "*" or a single width character given in the argument if the file is untagged, otherwise remove the tag.
Tag a file with '*' or a single width character given in the argument if the file is untagged, otherwise remove the tag.
Command Line Commands
@ -488,14 +472,11 @@ Quit command line mode and return to normal mode.
Autocomplete the current word.
cmd-menu-complete
Autocomplete the current word, then you can press the binded key/s
again to cycle completition options.
cmd-menu-complete-back
Autocomplete the current word, then you can press the binded key/s
again to cycle completition options backwards.
Autocomplete the current word with menu selection.
You need to assign keys to these commands (e.g. 'cmap <tab> cmd-menu-complete; cmap <backtab> cmd-menu-complete-back').
You can use the assigned keys assigned to display the menu and then cycle through completion options.
cmd-enter (default '<c-j>' and '<enter>')
@ -571,6 +552,14 @@ When this option is enabled, find command starts matching patterns from the begi
Automatically quit server when there are no clients left connected.
cleaner string (default '') (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 had its preview cache disabled.
One argument is passed to the file, path to the file whose preview should be cleaned.
Preview clearing is disabled when the value of this option is left empty.
dircache bool (default on)
Cache directory contents.
@ -618,8 +607,8 @@ 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.
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 '.*')
@ -631,19 +620,15 @@ In addition, if a pattern starts with '!', then its matches are excluded from hi
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='...'; ...'.
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.
This option does not have any effect on Windows.
ignorecase bool (default on)
@ -667,6 +652,14 @@ 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.
infotimefmtnew string (default 'Jan _2 15:04')
Format string of the file time shown in the info column when it matches this year.
infotimefmtold string (default 'Jan _2 2006')
Format string of the file time shown in the info column when it doesn't match this year.
mouse bool (default off)
Send mouse events as input.
@ -674,7 +667,7 @@ Send mouse events as input.
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.
When 'relativenumber' option is enabled, only the current line shows the absolute position and relative positions are shown for the rest.
period int (default 0)
@ -694,18 +687,12 @@ Files containing the null character (U+0000) in the read portion are considered
Set the path of a previewer file to filter the content of regular files for 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 are width, height, horizontal position, and vertical position of preview pane respectively.
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.
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.
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 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.
promptfmt string (default "\033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f\033[0m")
Format string of the prompt shown in the top line.
@ -734,12 +721,12 @@ Minimum number of offset lines shown at all times in the top and the bottom of t
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.
shell string (default 'sh' for unix and 'cmd' for windows)
shell string (default 'sh' for Unix and 'cmd' for Windows)
Shell executable to use for shell commands.
Shell commands are executed as 'shell shellopts shellflag command -- arguments'.
shellflag string (default '-c' for unix and '/c' for windows)
shellflag string (default '-c' for Unix and '/c' for Windows)
Command line flag used to pass shell commands.
@ -766,6 +753,10 @@ Currently supported sort types are 'natural', 'name', 'size', 'time', 'ctime', '
Number of space characters to show for horizontal tabulation (U+0009) character.
tagfmt string (default "\033[31m%s\033[0m")
Format string of the tags.
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.
@ -774,14 +765,6 @@ A string that lists all marks to treat as temporary. They are not synced to othe
Format string of the file modification time shown in the bottom line.
infotimefmtnew string (default 'Jan _2 15:04')
Format string of the file time shown in the info column when it matches this year.
infotimefmtold string (default 'Jan _2 2006')
Format string of the file time shown in the info column when it doesn't match this year.
truncatechar string (default '~')
Truncate character shown at the end when the file name does not fit to the pane.
@ -798,10 +781,6 @@ Searching can wrap around the file list.
Scrolling can wrap around the file list.
tagfmt string (default "\033[31m%s\033[0m")
Format string of the tags.
Environment Variables
The following variables are exported for shell commands:
@ -843,15 +822,15 @@ If this variable is set in the environment, use the same value, otherwise set th
EDITOR
If this variable is set in the environment, use the same value, otherwise set the value to 'vi' on unix, 'notepad' in Windows.
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.
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.
If this variable is set in the environment, use the same value, otherwise set the value to 'sh' on Unix, 'cmd' in Windows.
lf_{option}
@ -863,38 +842,26 @@ Special Commands
This shell command can be defined to override the default 'open' command when the current file is not a directory.
(See also 'OPENER' variable and 'Opening Files' section)
paste
This shell command can be defined to override the default 'paste' command.
(See also 'File Operations' section)
rename
This shell command can be defined to override the default 'paste' command.
(See also 'File Operations' section)
delete
This shell command can be defined to override the default 'delete' command.
(See also 'File Operations' section)
pre-cd
This shell command can be defined to be executed before changing a directory.
(See also 'Changing Directory' section)
on-cd
This shell command can be defined to be executed after changing a directory.
(See also 'Changing Directory' section)
on-quit
This shell command can be defined to be executed before quit.
@ -920,7 +887,7 @@ Characters from '#' to newline are comments and ignored:
# comments start with '#'
There are three special commands ('set', 'map', and 'cmd') and their variants for configuration.
There are three special commands ('set', 'map', 'cmap', and 'cmd') for configuration.
Command 'set' is used to set an option which can be boolean, integer, or string:
@ -1106,7 +1073,7 @@ Also, even when there is no output or error, the ui still needs to be paused whi
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.
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:
@ -1137,7 +1104,7 @@ 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.
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:
@ -1293,18 +1260,18 @@ 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.
This can be used to highlight source codes, list contents of archive files or view pdf or image files to name few.
For coloring lf recognizes ansi escape codes.
In order to use this feature you need to set the value of 'previewer' option 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.
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.
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 any:
You may also want to use the same script in your pager mapping as well:
set previewer ~/.config/lf/pv.sh
map i $~/.config/lf/pv.sh $f | less -R
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:
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 still be displayed in the statusline below:
set previewer ~/.config/lf/pv.sh
map i $LESSOPEN='| ~/.config/lf/pv.sh %s' less -R $f
@ -1344,7 +1311,8 @@ 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.
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
https://github.com/gokcehan/lf/tree/master/etc
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:
@ -1371,13 +1339,12 @@ The following xterm specific escape sequence sets the terminal title to the work
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 &{{ # ... }}
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.
Note that all shell commands are possible but '%' and '&' are usually more appropriate as '$' and '!' causes flickers and pauses respectively.
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.
Colors
@ -1402,7 +1369,7 @@ First, you can only configure 8 basic colors used by your terminal and lf should
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.
Second, you can set the values of environment variables mentioned above for fine grained customization.
Second, you can set the values of environment variables or colors file 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.
@ -1410,8 +1377,9 @@ Lastly, you may also want to configure the colors of the prompt line to match th
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.
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".
It is worth noting that lf uses as many colors advertised by your terminal's 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 '$COLORTERM' variable to 'truecolor' or ensuring '$TERM' is set to a value that ends with '-truecolor'.
Default lf colors are mostly taken from GNU dircolors defaults.
These defaults use 8 basic colors and bold attribute.
@ -1434,7 +1402,7 @@ Default values are as follows given with their matching order in lf:
ex 01;32
fi 00
Note that, lf first tries matching file names and then falls back to file types.
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')
@ -1497,9 +1465,9 @@ You may instead divide it to multiple lines in between double quotes by escaping
Having such a long variable definition in a shell configuration file might be undesirable.
You may instead use the colors file for configuration.
A sample colors file can be found at
https://github.com/gokcehan/lf/blob/master/etc/colors.example .
https://github.com/gokcehan/lf/blob/master/etc/colors.example
You may also see the wiki page for ansi escape codes
https://en.wikipedia.org/wiki/ANSI_escape_code .
https://en.wikipedia.org/wiki/ANSI_escape_code
Icons
@ -1526,6 +1494,6 @@ Default values are as follows given with their matching order in lf:
fi -
A sample icons file can be found at
https://github.com/gokcehan/lf/blob/master/etc/icons.example .
https://github.com/gokcehan/lf/blob/master/etc/icons.example
*/
package main

View File

@ -6,13 +6,12 @@ var genDocString = `
lf is a terminal file manager.
Source code can be found in the repository at https://github.com/gokcehan/lf
.
This documentation can either be read from terminal using 'lf -doc' or
online at https://pkg.go.dev/github.com/gokcehan/lf . You can also use 'doc'
online at https://pkg.go.dev/github.com/gokcehan/lf You can also use 'doc'
command (default '<f-1>') inside lf to view the documentation in a pager. A
man page with the same content is also available in the repository at
https://github.com/gokcehan/lf/blob/master/lf.1 .
https://github.com/gokcehan/lf/blob/master/lf.1
You can run 'lf -help' to see descriptions of command line options.
@ -32,6 +31,8 @@ The following commands are provided by lf:
scroll-down (default '<c-e>')
updir (default 'h' and '<left>')
open (default 'l' and '<right>')
jump-next (default ']')
jump-prev (default '[')
top (default 'gg' and '<home>')
bottom (default 'G' and '<end>')
toggle
@ -77,7 +78,7 @@ The following commands are provided by lf:
mark-load (modal) (default "'")
mark-remove (modal) (default '"')
tag
tag-toggle (default t)
tag-toggle (default 't')
The following command line commands are provided by lf:
@ -143,8 +144,8 @@ The following options can be used to customize the behavior of lf:
relativenumber bool (default off)
reverse bool (default off)
scrolloff int (default 0)
shell string (default 'sh' for unix and 'cmd' for windows)
shellflag string (default '-c' for unix and '/c' for windows)
shell string (default 'sh' for Unix and 'cmd' for Windows)
shellflag string (default '-c' for Unix and '/c' for Windows)
shellopts []string (default '')
smartcase bool (default on)
smartdia bool (default off)
@ -186,7 +187,7 @@ lf when defined:
The following commands/keybindings are provided by default:
unix windows
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%
@ -214,39 +215,39 @@ Configuration
Configuration files should be located at:
os system-wide user-specific
unix /etc/lf/lfrc ~/.config/lf/lfrc
windows C:\ProgramData\lf\lfrc C:\Users\<user>\AppData\Local\lf\lfrc
OS system-wide user-specific
Unix /etc/lf/lfrc ~/.config/lf/lfrc
Windows C:\ProgramData\lf\lfrc C:\Users\<user>\AppData\Local\lf\lfrc
Colors file should be located at:
unix ~/.local/share/lf/colors
windows C:\Users\<user>\AppData\Local\lf\colors
Unix ~/.local/share/lf/colors
Windows C:\Users\<user>\AppData\Local\lf\colors
Icons file should be located at:
unix ~/.local/share/lf/icons
windows C:\Users\<user>\AppData\Local\lf\icons
Unix ~/.local/share/lf/icons
Windows C:\Users\<user>\AppData\Local\lf\icons
Selection file should be located at:
unix ~/.local/share/lf/files
windows C:\Users\<user>\AppData\Local\lf\files
Unix ~/.local/share/lf/files
Windows C:\Users\<user>\AppData\Local\lf\files
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
Unix ~/.local/share/lf/marks
Windows C:\Users\<user>\AppData\Local\lf\marks
Tags file should be located at:
unix ~/.local/share/lf/tags
windows C:\Users\<user>\AppData\Local\lf\tags
Unix ~/.local/share/lf/tags
Windows C:\Users\<user>\AppData\Local\lf\tags
History file should be located at:
Unix ~/.local/share/lf/history
Windows C:\Users\<user>\AppData\Local\lf\history
You can configure the default values of following variables to change these
locations:
@ -257,7 +258,7 @@ locations:
%LOCALAPPDATA% C:\Users\<user>\AppData\Local
A sample configuration file can be found at
https://github.com/gokcehan/lf/blob/master/etc/lfrc.example .
https://github.com/gokcehan/lf/blob/master/etc/lfrc.example
Commands
@ -294,15 +295,10 @@ 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)
jump-next (default ']')
jump-prev (default '[')
Change the current working directory to the previous jumplist item.
jump-next (default ']')
Change the current working directory to the next jumplist item.
Change the current working directory to the next/previous jumplist item.
top (default 'gg' and '<home>')
bottom (default 'G' and '<end>')
@ -326,16 +322,15 @@ invert'), though this will also remove selections in other directories.
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.
Select/unselect files that match the given glob.
calcdirsize
Get the total size for each of the selected directories.
Calculate the total size for each of the selected directories. Option 'info'
should include 'size' and option 'dircounts' should be disabled to show this
size.
copy (default 'y')
@ -349,7 +344,8 @@ buffer, otherwise, copy the paths of selected files.
paste (default 'p')
Copy/Move files in copy/cut buffer to the current working directory.
Copy/Move files in copy/cut buffer to the current working directory. A
custom 'paste' command can be defined to override this default.
clear (default 'c')
@ -388,7 +384,7 @@ file.
echoerr
Print given arguments to the message line at the bottom in red color and
Print given arguments to the message line at the bottom as 'errorfmt' and
also to the log file.
cd
@ -401,7 +397,8 @@ Change the current file selection to the given argument.
delete (modal)
Remove the current file or selected file(s).
Remove the current file or selected file(s). A custom 'delete' command can
be defined to override this default.
rename (modal) (default 'r')
@ -424,21 +421,15 @@ Read a command to evaluate.
Read a shell command to execute.
(See also 'Prefixes' and 'Shell Commands' sections)
shell-pipe (modal) (default '%')
Read a shell command to execute piping its standard I/O to the bottom
statline.
(See also 'Prefixes' and 'Piping Shell Commands' sections)
shell-wait (modal) (default '!')
Read a shell command to execute and wait for a key press in the end.
(See also 'Prefixes' and 'Waiting Shell Commands' sections)
shell-async (modal) (default '&')
Read a shell command to execute asynchronously without standard I/O.
@ -451,9 +442,6 @@ Read a shell command to execute asynchronously without standard I/O.
Read key(s) to find the appropriate file name match in the forward/backward
direction and jump to the next/previous match.
(See also 'anchorfind', 'findlen', 'wrapscan', 'ignorecase', 'smartcase',
'ignoredia', and 'smartdia' options and 'Searching Files' section)
search (default '/')
search-back (default '?')
search-next (default 'n')
@ -462,19 +450,13 @@ direction and jump to the next/previous match.
Read a pattern to search for a file name match in the forward/backward
direction and jump to the next/previous match.
(See also 'globsearch', 'incsearch', 'wrapscan', 'ignorecase', 'smartcase',
'ignoredia', and 'smartdia' options and 'Searching Files' section)
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 immediately.
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)
Command 'filter' reads a pattern to filter out and only view files matching
the pattern. Command 'setfilter' does the same but uses an argument to set
the filter immediately. You can supply an argument to 'filter', in order to
use that as the starting prompt.
mark-save (modal) (default 'm')
@ -492,11 +474,11 @@ Remove a bookmark assigned to the given key.
tag
Tag a file with "*" or a single width character given in the argument.
Tag a file with '*' or a single width character given in the argument.
tag-toggle (default 't')
Tag a file with "*" or a single width character given in the argument if the
Tag a file with '*' or a single width character given in the argument if the
file is untagged, otherwise remove the tag.
@ -516,14 +498,12 @@ Quit command line mode and return to normal mode.
Autocomplete the current word.
cmd-menu-complete
Autocomplete the current word, then you can press the binded key/s again to
cycle completition options.
cmd-menu-complete-back
Autocomplete the current word, then you can press the binded key/s again to
cycle completition options backwards.
Autocomplete the current word with menu selection. You need to assign keys
to these commands (e.g. 'cmap <tab> cmd-menu-complete; cmap <backtab>
cmd-menu-complete-back'). You can use the assigned keys assigned to display
the menu and then cycle through completion options.
cmd-enter (default '<c-j>' and '<enter>')
@ -602,6 +582,14 @@ beginning of file names, otherwise, it can match at an arbitrary position.
Automatically quit server when there are no clients left connected.
cleaner string (default '') (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 had its preview cache disabled. One argument is passed to the
file, path to the file whose preview should be cleaned. Preview clearing is
disabled when the value of this option is left empty.
dircache bool (default on)
Cache directory contents.
@ -652,8 +640,8 @@ 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
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 '.*')
@ -666,20 +654,16 @@ 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.
Show icons before each item in the list.
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
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.
have any effect on Windows.
ignorecase bool (default on)
@ -704,6 +688,16 @@ 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.
infotimefmtnew string (default 'Jan _2 15:04')
Format string of the file time shown in the info column when it matches this
year.
infotimefmtold string (default 'Jan _2 2006')
Format string of the file time shown in the info column when it doesn't
match this year.
mouse bool (default off)
Send mouse events as input.
@ -711,7 +705,7 @@ Send mouse events as input.
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
'relativenumber' option is enabled, only the current line shows the absolute
position and relative positions are shown for the rest.
period int (default 0)
@ -734,21 +728,13 @@ binary files and displayed as 'binary'.
Set the path of a previewer file to filter the content of regular files for
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
are width, height, horizontal position, and 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.
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
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.
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.
promptfmt string (default "\033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f\033[0m")
@ -784,12 +770,12 @@ 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.
shell string (default 'sh' for unix and 'cmd' for windows)
shell string (default 'sh' for Unix and 'cmd' for Windows)
Shell executable to use for shell commands. Shell commands are executed as
'shell shellopts shellflag command -- arguments'.
shellflag string (default '-c' for unix and '/c' for windows)
shellflag string (default '-c' for Unix and '/c' for Windows)
Command line flag used to pass shell commands.
@ -817,6 +803,10 @@ Sort type for directories. Currently supported sort types are 'natural',
Number of space characters to show for horizontal tabulation (U+0009)
character.
tagfmt string (default "\033[31m%s\033[0m")
Format string of the tags.
tempmarks string (default '')
A string that lists all marks to treat as temporary. They are not synced to
@ -829,16 +819,6 @@ treated as temporary and does not need to be specified.
Format string of the file modification time shown in the bottom line.
infotimefmtnew string (default 'Jan _2 15:04')
Format string of the file time shown in the info column when it matches this
year.
infotimefmtold string (default 'Jan _2 2006')
Format string of the file time shown in the info column when it doesn't
match this year.
truncatechar string (default '~')
Truncate character shown at the end when the file name does not fit to the
@ -856,10 +836,6 @@ Searching can wrap around the file list.
Scrolling can wrap around the file list.
tagfmt string (default "\033[31m%s\033[0m")
Format string of the tags.
Environment Variables
@ -911,17 +887,17 @@ 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.
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.
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.
set the value to 'sh' on Unix, 'cmd' in Windows.
lf_{option}
@ -934,39 +910,27 @@ Special Commands
This shell command can be defined to override the default 'open' command
when the current file is not a directory.
(See also 'OPENER' variable and 'Opening Files' section)
paste
This shell command can be defined to override the default 'paste' command.
(See also 'File Operations' section)
rename
This shell command can be defined to override the default 'paste' command.
(See also 'File Operations' section)
delete
This shell command can be defined to override the default 'delete' command.
(See also 'File Operations' section)
pre-cd
This shell command can be defined to be executed before changing a
directory.
(See also 'Changing Directory' section)
on-cd
This shell command can be defined to be executed after changing a directory.
(See also 'Changing Directory' section)
on-quit
This shell command can be defined to be executed before quit.
@ -995,8 +959,8 @@ Characters from '#' to newline are comments and ignored:
# comments start with '#'
There are three special commands ('set', 'map', and 'cmd') and their
variants for configuration.
There are three special commands ('set', 'map', 'cmap', and 'cmd') for
configuration.
Command 'set' is used to set an option which can be boolean, integer, or
string:
@ -1206,7 +1170,7 @@ 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
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
@ -1247,7 +1211,7 @@ 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
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 ${XDG_RUNTIME_DIR:-/tmp}/lf.${USER}.sock
@ -1438,22 +1402,22 @@ 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.
codes, list contents of archive files or view pdf or image files to name
few. For coloring lf recognizes ansi escape codes.
In order to use this feature you need to set the value of 'previewer' option
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
any:
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. 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:
set previewer ~/.config/lf/pv.sh
map i $~/.config/lf/pv.sh $f | less -R
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:
useful information about the file such as the full path of the file can
still be displayed in the statusline below:
set previewer ~/.config/lf/pv.sh
map i $LESSOPEN='| ~/.config/lf/pv.sh %s' less -R $f
@ -1502,8 +1466,8 @@ 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.
you can use one of the example lfcd wrapper shell scripts provided in the
repository at https://github.com/gokcehan/lf/tree/master/etc
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
@ -1532,15 +1496,14 @@ title to the working directory:
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 &{{ # ... }}
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.
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.
the directory is actually changed.
Colors
@ -1571,11 +1534,11 @@ 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.
Second, you can set the values of environment 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.
Second, you can set the values of environment variables or colors file
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.
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
@ -1583,13 +1546,13 @@ 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.
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".
It is worth noting that lf uses as many colors advertised by your terminal's
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
'$COLORTERM' variable to 'truecolor' or ensuring '$TERM' is set to a value
that ends with '-truecolor'.
Default lf colors are mostly taken from GNU dircolors defaults. These
defaults use 8 basic colors and bold attribute. Default dircolors entries
@ -1613,7 +1576,7 @@ with their matching order in lf:
ex 01;32
fi 00
Note that, lf first tries matching file names and then falls back to file
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:
@ -1681,9 +1644,9 @@ newlines with backslashes as follows:
Having such a long variable definition in a shell configuration file might
be undesirable. You may instead use the colors file for configuration. A
sample colors file can be found at
https://github.com/gokcehan/lf/blob/master/etc/colors.example . You may also
https://github.com/gokcehan/lf/blob/master/etc/colors.example You may also
see the wiki page for ansi escape codes
https://en.wikipedia.org/wiki/ANSI_escape_code .
https://en.wikipedia.org/wiki/ANSI_escape_code
Icons
@ -1712,5 +1675,5 @@ in lf:
fi -
A sample icons file can be found at
https://github.com/gokcehan/lf/blob/master/etc/icons.example .
https://github.com/gokcehan/lf/blob/master/etc/icons.example
`

View File

@ -36,7 +36,7 @@ lf \- terminal file manager
.OP \-single
.OP \-version
.OP \-help
.RI [ select-path ]
.RI [ cd-or-select-path ]
.YS
.SH DESCRIPTION
END

225
lf.1
View File

@ -17,14 +17,14 @@ lf \- terminal file manager
.OP \-single
.OP \-version
.OP \-help
.RI [ select-path ]
.RI [ cd-or-select-path ]
.YS
.SH DESCRIPTION
lf is a terminal file manager.
.PP
Source code can be found in the repository at https://github.com/gokcehan/lf .
Source code can be found in the repository at https://github.com/gokcehan/lf
.PP
This documentation can either be read from terminal using 'lf -doc' or online at https://pkg.go.dev/github.com/gokcehan/lf . You can also use 'doc' command (default '<f-1>') inside lf to view the documentation in a pager. A man page with the same content is also available in the repository at https://github.com/gokcehan/lf/blob/master/lf.1 .
This documentation can either be read from terminal using 'lf -doc' or online at https://pkg.go.dev/github.com/gokcehan/lf You can also use 'doc' command (default '<f-1>') inside lf to view the documentation in a pager. A man page with the same content is also available in the repository at https://github.com/gokcehan/lf/blob/master/lf.1
.PP
You can run 'lf -help' to see descriptions of command line options.
.SH QUICK REFERENCE
@ -42,6 +42,8 @@ The following commands are provided by lf:
scroll-down (default '<c-e>')
updir (default 'h' and '<left>')
open (default 'l' and '<right>')
jump-next (default ']')
jump-prev (default '[')
top (default 'gg' and '<home>')
bottom (default 'G' and '<end>')
toggle
@ -85,9 +87,9 @@ The following commands are provided by lf:
setfilter
mark-save (modal) (default 'm')
mark-load (modal) (default "'")
mark-remove (modal) (default `"`)
mark-remove (modal) (default '"')
tag
tag-toggle (default t)
tag-toggle (default 't')
.EE
.PP
The following command line commands are provided by lf:
@ -157,8 +159,8 @@ The following options can be used to customize the behavior of lf:
relativenumber bool (default off)
reverse bool (default off)
scrolloff int (default 0)
shell string (default 'sh' for unix and 'cmd' for windows)
shellflag string (default '-c' for unix and '/c' for windows)
shell string (default 'sh' for Unix and 'cmd' for Windows)
shellflag string (default '-c' for Unix and '/c' for Windows)
shellopts []string (default '')
smartcase bool (default on)
smartdia bool (default off)
@ -205,7 +207,7 @@ The following special shell commands are used to customize the behavior of lf wh
The following commands/keybindings are provided by default:
.PP
.EX
unix windows
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%
@ -234,51 +236,51 @@ The following additional keybindings are provided by default:
Configuration files should be located at:
.PP
.EX
os system-wide user-specific
unix /etc/lf/lfrc ~/.config/lf/lfrc
windows C:\eProgramData\elf\elfrc C:\eUsers\e<user>\eAppData\eLocal\elf\elfrc
OS system-wide user-specific
Unix /etc/lf/lfrc ~/.config/lf/lfrc
Windows C:\eProgramData\elf\elfrc C:\eUsers\e<user>\eAppData\eLocal\elf\elfrc
.EE
.PP
Colors file should be located at:
.PP
.EX
unix ~/.local/share/lf/colors
windows C:\eUsers\e<user>\eAppData\eLocal\elf\ecolors
Unix ~/.local/share/lf/colors
Windows C:\eUsers\e<user>\eAppData\eLocal\elf\ecolors
.EE
.PP
Icons file should be located at:
.PP
.EX
unix ~/.local/share/lf/icons
windows C:\eUsers\e<user>\eAppData\eLocal\elf\eicons
Unix ~/.local/share/lf/icons
Windows C:\eUsers\e<user>\eAppData\eLocal\elf\eicons
.EE
.PP
Selection file should be located at:
.PP
.EX
unix ~/.local/share/lf/files
windows C:\eUsers\e<user>\eAppData\eLocal\elf\efiles
Unix ~/.local/share/lf/files
Windows C:\eUsers\e<user>\eAppData\eLocal\elf\efiles
.EE
.PP
Marks file should be located at:
.PP
.EX
unix ~/.local/share/lf/marks
windows C:\eUsers\e<user>\eAppData\eLocal\elf\emarks
.EE
.PP
History file should be located at:
.PP
.EX
unix ~/.local/share/lf/history
windows C:\eUsers\e<user>\eAppData\eLocal\elf\ehistory
Unix ~/.local/share/lf/marks
Windows C:\eUsers\e<user>\eAppData\eLocal\elf\emarks
.EE
.PP
Tags file should be located at:
.PP
.EX
unix ~/.local/share/lf/tags
windows C:\eUsers\e<user>\eAppData\eLocal\elf\etags
Unix ~/.local/share/lf/tags
Windows C:\eUsers\e<user>\eAppData\eLocal\elf\etags
.EE
.PP
History file should be located at:
.PP
.EX
Unix ~/.local/share/lf/history
Windows C:\eUsers\e<user>\eAppData\eLocal\elf\ehistory
.EE
.PP
You can configure the default values of following variables to change these locations:
@ -290,7 +292,7 @@ You can configure the default values of following variables to change these loca
%LOCALAPPDATA% C:\eUsers\e<user>\eAppData\eLocal
.EE
.PP
A sample configuration file can be found at https://github.com/gokcehan/lf/blob/master/etc/lfrc.example .
A sample configuration file can be found at https://github.com/gokcehan/lf/blob/master/etc/lfrc.example
.SH COMMANDS
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.
.PP
@ -325,19 +327,12 @@ Change the current working directory to the parent directory.
.PP
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.
.PP
(See also 'OPENER' variable and 'Opening Files' section)
.PP
.EX
jump-next (default ']')
jump-prev (default '[')
.EE
.PP
Change the current working directory to the previous jumplist item.
.PP
.EX
jump-next (default ']')
.EE
.PP
Change the current working directory to the next jumplist item.
Change the current working directory to the next/previous jumplist item.
.PP
.EX
top (default 'gg' and '<home>')
@ -356,7 +351,7 @@ Toggle the selection of the current file or files given as arguments.
invert (default 'v')
.EE
.PP
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.
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.
.PP
.EX
unselect (default 'u')
@ -366,21 +361,16 @@ Remove the selection of all files in all directories.
.PP
.EX
glob-select
.EE
.PP
Select files that match the given glob.
.PP
.EX
glob-unselect
.EE
.PP
Unselect files that match the given glob.
Select/unselect files that match the given glob.
.PP
.EX
calcdirsize
.EE
.PP
Get the total size for each of the selected directories.
Calculate the total size for each of the selected directories. Option 'info' should include 'size' and option 'dircounts' should be disabled to show this size.
.PP
.EX
copy (default 'y')
@ -398,7 +388,7 @@ If there are no selections, save the path of the current file to the cut buffer,
paste (default 'p')
.EE
.PP
Copy/Move files in copy/cut buffer to the current working directory.
Copy/Move files in copy/cut buffer to the current working directory. A custom 'paste' command can be defined to override this default.
.PP
.EX
clear (default 'c')
@ -452,7 +442,7 @@ Print given arguments to the message line at the bottom and also to the log file
echoerr
.EE
.PP
Print given arguments to the message line at the bottom in red color and also to the log file.
Print given arguments to the message line at the bottom as 'errorfmt' and also to the log file.
.PP
.EX
cd
@ -470,7 +460,7 @@ Change the current file selection to the given argument.
delete (modal)
.EE
.PP
Remove the current file or selected file(s).
Remove the current file or selected file(s). A custom 'delete' command can be defined to override this default.
.PP
.EX
rename (modal) (default 'r')
@ -502,24 +492,18 @@ Read a command to evaluate.
.PP
Read a shell command to execute.
.PP
(See also 'Prefixes' and 'Shell Commands' sections)
.PP
.EX
shell-pipe (modal) (default '%')
.EE
.PP
Read a shell command to execute piping its standard I/O to the bottom statline.
.PP
(See also 'Prefixes' and 'Piping Shell Commands' sections)
.PP
.EX
shell-wait (modal) (default '!')
.EE
.PP
Read a shell command to execute and wait for a key press in the end.
.PP
(See also 'Prefixes' and 'Waiting Shell Commands' sections)
.PP
.EX
shell-async (modal) (default '&')
.EE
@ -535,8 +519,6 @@ Read a shell command to execute asynchronously without standard I/O.
.PP
Read key(s) to find the appropriate file name match in the forward/backward direction and jump to the next/previous match.
.PP
(See also 'anchorfind', 'findlen', 'wrapscan', 'ignorecase', 'smartcase', 'ignoredia', and 'smartdia' options and 'Searching Files' section)
.PP
.EX
search (default '/')
search-back (default '?')
@ -546,16 +528,12 @@ Read key(s) to find the appropriate file name match in the forward/backward dire
.PP
Read a pattern to search for a file name match in the forward/backward direction and jump to the next/previous match.
.PP
(See also 'globsearch', 'incsearch', 'wrapscan', 'ignorecase', 'smartcase', 'ignoredia', and 'smartdia' options and 'Searching Files' section)
.PP
.EX
filter (modal)
setfilter
.EE
.PP
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 immediately. You can supply an argument to filter, in order to use that as the starting prompt.
.PP
(See also 'globsearch', 'incfilter', 'ignorecase', 'smartcase', 'ignoredia', and 'smartdia' options)
Command 'filter' reads a pattern to filter out and only view files matching the pattern. Command 'setfilter' does the same but uses an argument to set the filter immediately. You can supply an argument to 'filter', in order to use that as the starting prompt.
.PP
.EX
mark-save (modal) (default 'm')
@ -570,7 +548,7 @@ Save the current directory as a bookmark assigned to the given key.
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.
.PP
.EX
mark-remove (modal) (default `"`)
mark-remove (modal) (default '"')
.EE
.PP
Remove a bookmark assigned to the given key.
@ -579,13 +557,13 @@ Remove a bookmark assigned to the given key.
tag
.EE
.PP
Tag a file with "*" or a single width character given in the argument.
Tag a file with '*' or a single width character given in the argument.
.PP
.EX
tag-toggle (default 't')
.EE
.PP
Tag a file with "*" or a single width character given in the argument if the file is untagged, otherwise remove the tag.
Tag a file with '*' or a single width character given in the argument if the file is untagged, otherwise remove the tag.
.SH 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.
.PP
@ -603,15 +581,10 @@ Autocomplete the current word.
.PP
.EX
cmd-menu-complete
.EE
.PP
Autocomplete the current word, then you can press the binded key/s again to cycle completition options.
.PP
.EX
cmd-menu-complete-back
.EE
.PP
Autocomplete the current word, then you can press the binded key/s again to cycle completition options backwards.
Autocomplete the current word with menu selection. You need to assign keys to these commands (e.g. 'cmap <tab> cmd-menu-complete; cmap <backtab> cmd-menu-complete-back'). You can use the assigned keys assigned to display the menu and then cycle through completion options.
.PP
.EX
cmd-enter (default '<c-j>' and '<enter>')
@ -714,6 +687,12 @@ When this option is enabled, find command starts matching patterns from the begi
.PP
Automatically quit server when there are no clients left connected.
.PP
.EX
cleaner string (default '') (not called if empty)
.EE
.PP
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 had its preview cache disabled. One argument is passed to the file, path to the file whose preview should be cleaned. Preview clearing is disabled when the value of this option is left empty.
.PP
.EX
dircache bool (default on)
.EE
@ -772,7 +751,7 @@ When this option is enabled, search command patterns are considered as globs, ot
hidden bool (default off)
.EE
.PP
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.
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.
.PP
.EX
hiddenfiles []string (default '.*')
@ -784,13 +763,13 @@ List of hidden file glob patterns. Patterns can be given as relative or absolute
icons bool (default off)
.EE
.PP
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.
Show icons before each item in the list.
.PP
.EX
ifs string (default '')
.EE
.PP
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.
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.
.PP
.EX
ignorecase bool (default on)
@ -822,6 +801,18 @@ Apply filter pattern after each keystroke during filtering.
.PP
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.
.PP
.EX
infotimefmtnew string (default 'Jan _2 15:04')
.EE
.PP
Format string of the file time shown in the info column when it matches this year.
.PP
.EX
infotimefmtold string (default 'Jan _2 2006')
.EE
.PP
Format string of the file time shown in the info column when it doesn't match this year.
.PP
.EX
mouse bool (default off)
.EE
@ -832,7 +823,7 @@ Send mouse events as input.
number bool (default off)
.EE
.PP
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.
Show the position number for directory items at the left side of pane. When 'relativenumber' option is enabled, only the current line shows the absolute position and relative positions are shown for the rest.
.PP
.EX
period int (default 0)
@ -850,13 +841,7 @@ Show previews of files and directories at the right most pane. If the file has m
previewer string (default '') (not filtered if empty)
.EE
.PP
Set the path of a previewer file to filter the content of regular files for 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 are width, height, horizontal position, and 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.
.PP
.EX
cleaner string (default '') (not called if empty)
.EE
.PP
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 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.
Set the path of a previewer file to filter the content of regular files for previewing. The file should be executable. 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. 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.
.PP
.EX
promptfmt string (default "\e033[32;1m%u@%h\e033[0m:\e033[34;1m%d\e033[0m\e033[1m%f\e033[0m")
@ -889,13 +874,13 @@ Reverse the direction of sort.
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.
.PP
.EX
shell string (default 'sh' for unix and 'cmd' for windows)
shell string (default 'sh' for Unix and 'cmd' for Windows)
.EE
.PP
Shell executable to use for shell commands. Shell commands are executed as 'shell shellopts shellflag command -- arguments'.
.PP
.EX
shellflag string (default '-c' for unix and '/c' for windows)
shellflag string (default '-c' for Unix and '/c' for Windows)
.EE
.PP
Command line flag used to pass shell commands.
@ -930,6 +915,12 @@ Sort type for directories. Currently supported sort types are 'natural', 'name',
.PP
Number of space characters to show for horizontal tabulation (U+0009) character.
.PP
.EX
tagfmt string (default "\e033[31m%s\e033[0m")
.EE
.PP
Format string of the tags.
.PP
.EX
tempmarks string (default '')
.EE
@ -942,18 +933,6 @@ A string that lists all marks to treat as temporary. They are not synced to othe
.PP
Format string of the file modification time shown in the bottom line.
.PP
.EX
infotimefmtnew string (default 'Jan _2 15:04')
.EE
.PP
Format string of the file time shown in the info column when it matches this year.
.PP
.EX
infotimefmtold string (default 'Jan _2 2006')
.EE
.PP
Format string of the file time shown in the info column when it doesn't match this year.
.PP
.EX
truncatechar string (default '~')
.EE
@ -977,12 +956,6 @@ Searching can wrap around the file list.
.EE
.PP
Scrolling can wrap around the file list.
.PP
.EX
tagfmt string (default "\e033[31m%s\e033[0m")
.EE
.PP
Format string of the tags.
.SH 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').
.PP
@ -1038,19 +1011,19 @@ If this variable is set in the environment, use the same value, otherwise set th
EDITOR
.EE
.PP
If this variable is set in the environment, use the same value, otherwise set the value to 'vi' on unix, 'notepad' in Windows.
If this variable is set in the environment, use the same value, otherwise set the value to 'vi' on Unix, 'notepad' in Windows.
.PP
.EX
PAGER
.EE
.PP
If this variable is set in the environment, use the same value, otherwise set the value to 'less' on unix, 'more' in Windows.
If this variable is set in the environment, use the same value, otherwise set the value to 'less' on Unix, 'more' in Windows.
.PP
.EX
SHELL
.EE
.PP
If this variable is set in the environment, use the same value, otherwise set the value to 'sh' on unix, 'cmd' in Windows.
If this variable is set in the environment, use the same value, otherwise set the value to 'sh' on Unix, 'cmd' in Windows.
.PP
.EX
lf_{option}
@ -1064,48 +1037,36 @@ Value of the {option}.
.EE
This shell command can be defined to override the default 'open' command when the current file is not a directory.
.PP
(See also 'OPENER' variable and 'Opening Files' section)
.PP
.EX
paste
.EE
.PP
This shell command can be defined to override the default 'paste' command.
.PP
(See also 'File Operations' section)
.PP
.EX
rename
.EE
.PP
This shell command can be defined to override the default 'paste' command.
.PP
(See also 'File Operations' section)
.PP
.EX
delete
.EE
.PP
This shell command can be defined to override the default 'delete' command.
.PP
(See also 'File Operations' section)
.PP
.EX
pre-cd
.EE
.PP
This shell command can be defined to be executed before changing a directory.
.PP
(See also 'Changing Directory' section)
.PP
.EX
on-cd
.EE
.PP
This shell command can be defined to be executed after changing a directory.
.PP
(See also 'Changing Directory' section)
.PP
.EX
on-quit
.EE
@ -1130,7 +1091,7 @@ Characters from '#' to newline are comments and ignored:
# comments start with '#'
.EE
.PP
There are three special commands ('set', 'map', and 'cmd') and their variants for configuration.
There are three special commands ('set', 'map', 'cmap', and 'cmd') for configuration.
.PP
Command 'set' is used to set an option which can be boolean, integer, or string:
.PP
@ -1340,7 +1301,7 @@ Finally note that we set 'IFS' variable manually in these commands. Instead we c
.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 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.
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.
.PP
For example, following rename command prompts for overwrite in the statline if there is an existing file with the given name:
.PP
@ -1362,7 +1323,7 @@ Asynchronous shell commands are used to start a command in the background and th
.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:
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:
.PP
.EX
echo 'send echo hello world' | nc -U ${XDG_RUNTIME_DIR:-/tmp}/lf.${USER}.sock
@ -1484,16 +1445,16 @@ Following command is provided by default:
.PP
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.
.SH 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.
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 to name few. For coloring lf recognizes ansi escape codes.
.PP
In order to use this feature you need to set the value of 'previewer' option 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 any:
In order to use this feature you need to set the value of 'previewer' 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. 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:
.PP
.EX
set previewer ~/.config/lf/pv.sh
map i $~/.config/lf/pv.sh $f | less -R
.EE
.PP
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:
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 still be displayed in the statusline below:
.PP
.EX
set previewer ~/.config/lf/pv.sh
@ -1525,7 +1486,7 @@ Another important consideration for efficiency is the use of programs with short
.PP
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.
.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 wrapper shell scripts provided in the repository.
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 https://github.com/gokcehan/lf/tree/master/etc
.PP
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:
.PP
@ -1554,13 +1515,13 @@ If you want to print escape sequences, you may redirect 'printf' output to '/dev
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:
.PP
.EX
cmd on-cd &{{ # ... }}
cmd on-cd &{{ ... }}
on-cd
.EE
.PP
Note that all shell commands are possible but `%` and `&` are usually more appropriate as `$` and `!` causes flickers and pauses respectively.
Note that all shell commands are possible but '%' and '&' are usually more appropriate as '$' and '!' causes flickers and pauses respectively.
.PP
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.
There is also a 'pre-cd' command, that works like 'on-cd', but is run before the directory is actually changed.
.SH 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:
.PP
@ -1576,11 +1537,11 @@ Please refer to the corresponding man pages for more information about 'LSCOLORS
.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 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.
Second, you can set the values of environment variables or colors file 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.
.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 '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.
.PP
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".
It is worth noting that lf uses as many colors advertised by your terminal's 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 '$COLORTERM' variable to 'truecolor' or ensuring '$TERM' is set to a value that ends with '-truecolor'.
.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:
.PP
@ -1601,7 +1562,7 @@ Default lf colors are mostly taken from GNU dircolors defaults. These defaults u
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:
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:
.PP
.EX
1. Full Path (e.g. '~/.config/lf/lfrc')
@ -1669,7 +1630,7 @@ Having all entries on a single line can make it hard to read. You may instead di
"
.EE
.PP
Having such a long variable definition in a shell configuration file might be undesirable. You may instead use the colors file for configuration. A sample colors file can be found at https://github.com/gokcehan/lf/blob/master/etc/colors.example . You may also see the wiki page for ansi escape codes https://en.wikipedia.org/wiki/ANSI_escape_code .
Having such a long variable definition in a shell configuration file might be undesirable. You may instead use the colors file for configuration. A sample colors file can be found at https://github.com/gokcehan/lf/blob/master/etc/colors.example You may also see the wiki page for ansi escape codes https://en.wikipedia.org/wiki/ANSI_escape_code
.SH ICONS
Icons are configured using 'LF_ICONS' environment variable or an icons file. The variable uses the same syntax as 'LS_COLORS/LF_COLORS'. Instead of colors, you should put a single characters as values of entries. Icons file should consist of whitespace separated pairs with '#' character to start comments until the end of line. Do not forget to enable 'icons' option to see the icons. Default values are as follows given with their matching order in lf:
.PP
@ -1690,4 +1651,4 @@ Icons are configured using 'LF_ICONS' environment variable or an icons file. The
fi -
.EE
.PP
A sample icons file can be found at https://github.com/gokcehan/lf/blob/master/etc/icons.example .
A sample icons file can be found at https://github.com/gokcehan/lf/blob/master/etc/icons.example

View File

@ -188,9 +188,9 @@ func main() {
f := flag.CommandLine.Output()
fmt.Fprintln(f, "lf - Terminal file manager")
fmt.Fprintln(f, "")
fmt.Fprintf(f, "Usage: %s [options] [select-path]\n\n", os.Args[0])
fmt.Fprintln(f, " select-path")
fmt.Fprintln(f, " set the initial file selection to the given argument")
fmt.Fprintf(f, "Usage: %s [options] [cd-or-select-path]\n\n", os.Args[0])
fmt.Fprintln(f, " cd-or-select-path")
fmt.Fprintln(f, " set the initial dir or file selection to the given argument")
fmt.Fprintln(f, "")
fmt.Fprintln(f, "Options:")
flag.PrintDefaults()