add descriptions of variables to the documentation

This commit is contained in:
Gokcehan 2020-10-02 23:37:39 +03:00
parent 88749a3da1
commit 4c89535e18
3 changed files with 211 additions and 110 deletions

97
doc.go
View File

@ -121,7 +121,7 @@ The following options can be used to customize the behavior of lf:
relativenumber bool (default off) relativenumber bool (default off)
reverse bool (default off) reverse bool (default off)
scrolloff int (default 0) scrolloff int (default 0)
shell string (default 'sh' for unix and 'cmd.exe' for windows) shell string (default 'sh' for unix and 'cmd' for windows)
shellopts []string (default '') shellopts []string (default '')
smartcase bool (default on) smartcase bool (default on)
smartdia bool (default off) smartdia bool (default off)
@ -132,35 +132,25 @@ The following options can be used to customize the behavior of lf:
wrapscan bool (default on) wrapscan bool (default on)
wrapscroll bool (default off) wrapscroll bool (default off)
The following variables are exported for shell commands: The following environment variables are exported for shell commands:
$f current file f
$fs selected file(s) separated with 'filesep' fs
$fx current file or selected file(s) if any fx
$id id number of the client id
LF_LEVEL
OPENER
EDITOR
PAGER
SHELL
For Windows, the above variables are exported as `%f%`, `%fs`, `%fx%` and `%id%` respectively. The following commands/keybindings are provided by default:
The following variables are set to the corresponding values: unix windows
cmd open &$OPENER "$f" cmd open &%OPENER% %f%
$LF_LEVEL current nesting level map e $$EDITOR "$f" map e $%EDITOR% %f%
map i $$PAGER "$f" map i !%PAGER% %f%
The following default values are set to the environmental variables on unix map w $$SHELL map w $%SHELL%
when they are not set or empty:
$OPENER open # macos
$OPENER xdg-open # others
$EDITOR vi
$PAGER less
$SHELL sh
The following default values are set to the environmental variables on windows
when they are not set or empty:
%OPENER% start
%EDITOR% notepad
%PAGER% more
%SHELL% cmd
The following additional keybindings are provided by default: The following additional keybindings are provided by default:
@ -179,12 +169,6 @@ The following additional keybindings are provided by default:
map gh cd ~ map gh cd ~
map <space> :toggle; down map <space> :toggle; down
The following keybindings to applications are provided by default:
map e $$EDITOR $f
map i $$PAGER $f
map w $$SHELL
Configuration Configuration
Configuration files should be located at: Configuration files should be located at:
@ -627,11 +611,11 @@ 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. 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. 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.exe' for windows) shell string (default 'sh' for unix and 'cmd' for windows)
Shell executable to use for shell commands. Shell executable to use for shell commands.
Shell commands are executed as 'shell shellopts -c command -- arguments'. Shell commands are executed as 'shell shellopts -c command -- arguments'.
On windows, '/c' is used instead of '-c' which should work in 'cmd.exe' and 'powershell.exe'. On windows, '/c' is used instead of '-c' which should work in 'cmd' and 'powershell'.
shellopts []string (default '') shellopts []string (default '')
@ -672,6 +656,49 @@ Searching can wrap around the file list.
Scrolling can wrap around the file list. Scrolling can wrap around the file list.
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.
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.
Prefixes Prefixes
The following command prefixes are used by lf: The following command prefixes are used by lf:

View File

@ -124,7 +124,7 @@ The following options can be used to customize the behavior of lf:
relativenumber bool (default off) relativenumber bool (default off)
reverse bool (default off) reverse bool (default off)
scrolloff int (default 0) scrolloff int (default 0)
shell string (default 'sh' for unix and 'cmd.exe' for windows) shell string (default 'sh' for unix and 'cmd' for windows)
shellopts []string (default '') shellopts []string (default '')
smartcase bool (default on) smartcase bool (default on)
smartdia bool (default off) smartdia bool (default off)
@ -135,36 +135,25 @@ The following options can be used to customize the behavior of lf:
wrapscan bool (default on) wrapscan bool (default on)
wrapscroll bool (default off) wrapscroll bool (default off)
The following variables are exported for shell commands: The following environment variables are exported for shell commands:
$f current file f
$fs selected file(s) separated with 'filesep' fs
$fx current file or selected file(s) if any fx
$id id number of the client id
LF_LEVEL
OPENER
EDITOR
PAGER
SHELL
For Windows, the above variables are exported as '%f%', '%fs', '%fx%' and The following commands/keybindings are provided by default:
'%id%' respectively.
The following variables are set to the corresponding values: unix windows
cmd open &$OPENER "$f" cmd open &%OPENER% %f%
$LF_LEVEL current nesting level map e $$EDITOR "$f" map e $%EDITOR% %f%
map i $$PAGER "$f" map i !%PAGER% %f%
The following default values are set to the environmental variables on unix map w $$SHELL map w $%SHELL%
when they are not set or empty:
$OPENER open # macos
$OPENER xdg-open # others
$EDITOR vi
$PAGER less
$SHELL sh
The following default values are set to the environmental variables on
windows when they are not set or empty:
%OPENER% start
%EDITOR% notepad
%PAGER% more
%SHELL% cmd
The following additional keybindings are provided by default: The following additional keybindings are provided by default:
@ -183,12 +172,6 @@ The following additional keybindings are provided by default:
map gh cd ~ map gh cd ~
map <space> :toggle; down map <space> :toggle; down
The following keybindings to applications are provided by default:
map e $$EDITOR $f
map i $$PAGER $f
map w $$SHELL
Configuration Configuration
@ -668,11 +651,11 @@ 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 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. beginning or end of the list to show the maximum number of items.
shell string (default 'sh' for unix and 'cmd.exe' 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 executable to use for shell commands. Shell commands are executed as
'shell shellopts -c command -- arguments'. On windows, '/c' is used instead 'shell shellopts -c command -- arguments'. On windows, '/c' is used instead
of '-c' which should work in 'cmd.exe' and 'powershell.exe'. of '-c' which should work in 'cmd' and 'powershell'.
shellopts []string (default '') shellopts []string (default '')
@ -716,6 +699,61 @@ Searching can wrap around the file list.
Scrolling can wrap around the file list. Scrolling can wrap around the file list.
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.
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.
Prefixes Prefixes
The following command prefixes are used by lf: The following command prefixes are used by lf:

114
lf.1
View File

@ -135,7 +135,7 @@ The following options can be used to customize the behavior of lf:
relativenumber bool (default off) relativenumber bool (default off)
reverse bool (default off) reverse bool (default off)
scrolloff int (default 0) scrolloff int (default 0)
shell string (default 'sh' for unix and 'cmd.exe' for windows) shell string (default 'sh' for unix and 'cmd' for windows)
shellopts []string (default '') shellopts []string (default '')
smartcase bool (default on) smartcase bool (default on)
smartdia bool (default off) smartdia bool (default off)
@ -147,40 +147,28 @@ The following options can be used to customize the behavior of lf:
wrapscroll bool (default off) wrapscroll bool (default off)
.EE .EE
.PP .PP
The following variables are exported for shell commands: The following environment variables are exported for shell commands:
.PP .PP
.EX .EX
$f current file f
$fs selected file(s) separated with 'filesep' fs
$fx current file or selected file(s) if any fx
$id id number of the client id
LF_LEVEL
OPENER
EDITOR
PAGER
SHELL
.EE .EE
.PP .PP
For Windows, the above variables are exported as `%f%`, `%fs`, `%fx%` and `%id%` respectively. The following commands/keybindings are provided by default:
.PP
The following variables are set to the corresponding values:
.PP .PP
.EX .EX
$LF_LEVEL current nesting level unix windows
.EE cmd open &$OPENER "$f" cmd open &%OPENER% %f%
.PP map e $$EDITOR "$f" map e $%EDITOR% %f%
The following default values are set to the environmental variables on unix when they are not set or empty: map i $$PAGER "$f" map i !%PAGER% %f%
.PP map w $$SHELL map w $%SHELL%
.EX
$OPENER open # macos
$OPENER xdg-open # others
$EDITOR vi
$PAGER less
$SHELL sh
.EE
.PP
The following default values are set to the environmental variables on windows when they are not set or empty:
.PP
.EX
%OPENER% start
%EDITOR% notepad
%PAGER% more
%SHELL% cmd
.EE .EE
.PP .PP
The following additional keybindings are provided by default: The following additional keybindings are provided by default:
@ -201,14 +189,6 @@ The following additional keybindings are provided by default:
map gh cd ~ map gh cd ~
map <space> :toggle; down map <space> :toggle; down
.EE .EE
.PP
The following keybindings to applications are provided by default:
.PP
.EX
map e $$EDITOR $f
map i $$PAGER $f
map w $$SHELL
.EE
.SH CONFIGURATION .SH CONFIGURATION
Configuration files should be located at: Configuration files should be located at:
.PP .PP
@ -751,10 +731,10 @@ 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. 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 .PP
.EX .EX
shell string (default 'sh' for unix and 'cmd.exe' for windows) shell string (default 'sh' for unix and 'cmd' for windows)
.EE .EE
.PP .PP
Shell executable to use for shell commands. Shell commands are executed as 'shell shellopts -c command -- arguments'. On windows, '/c' is used instead of '-c' which should work in 'cmd.exe' and 'powershell.exe'. Shell executable to use for shell commands. Shell commands are executed as 'shell shellopts -c command -- arguments'. On windows, '/c' is used instead of '-c' which should work in 'cmd' and 'powershell'.
.PP .PP
.EX .EX
shellopts []string (default '') shellopts []string (default '')
@ -809,6 +789,62 @@ Searching can wrap around the file list.
.EE .EE
.PP .PP
Scrolling can wrap around the file list. Scrolling can wrap around the file list.
.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
.EX
f
.EE
.PP
Current file selection as a full path.
.PP
.EX
fs
.EE
.PP
Selected file(s) separated with the value of 'filesep' option as full path(s).
.PP
.EX
fx
.EE
.PP
Selected file(s) (i.e. 'fs') if there are any selected files, otherwise current file selection (i.e. 'f').
.PP
.EX
id
.EE
.PP
Id of the running client.
.PP
.EX
LF_LEVEL
.EE
.PP
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').
.PP
.EX
OPENER
.EE
.PP
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.
.PP
.EX
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.
.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.
.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.
.SH PREFIXES .SH PREFIXES
The following command prefixes are used by lf: The following command prefixes are used by lf:
.PP .PP