Reorder commands to be consistent with documentation (#2075)
This commit is contained in:
1 parent
47b3bc5617
commit
9183e81f7f
4 files changed
+622
-601
No files matched your search
@@ -57,13 +57,10 @@ The following commands are provided by lf:
|
|||||||
middle (default 'M')
|
middle (default 'M')
|
||||||
low (default 'L')
|
low (default 'L')
|
||||||
toggle
|
toggle
|
||||||
visual (default 'V')
|
|
||||||
invert (default 'v')
|
invert (default 'v')
|
||||||
unselect (default 'u')
|
unselect (default 'u')
|
||||||
glob-select
|
glob-select
|
||||||
glob-unselect
|
glob-unselect
|
||||||
calcdirsize
|
|
||||||
clearmaps
|
|
||||||
copy (default 'y')
|
copy (default 'y')
|
||||||
cut (default 'd')
|
cut (default 'd')
|
||||||
paste (default 'p')
|
paste (default 'p')
|
||||||
@@ -73,15 +70,8 @@ The following commands are provided by lf:
|
|||||||
redraw (default '<c-l>')
|
redraw (default '<c-l>')
|
||||||
load
|
load
|
||||||
reload (default '<c-r>')
|
reload (default '<c-r>')
|
||||||
echo
|
|
||||||
echomsg
|
|
||||||
echoerr
|
|
||||||
cd
|
|
||||||
select
|
|
||||||
delete (modal)
|
delete (modal)
|
||||||
rename (modal) (default 'r')
|
rename (modal) (default 'r')
|
||||||
source
|
|
||||||
push
|
|
||||||
read (modal) (default ':')
|
read (modal) (default ':')
|
||||||
shell (modal) (default '$')
|
shell (modal) (default '$')
|
||||||
shell-pipe (modal) (default '%')
|
shell-pipe (modal) (default '%')
|
||||||
@@ -102,8 +92,18 @@ The following commands are provided by lf:
|
|||||||
mark-remove (modal) (default '"')
|
mark-remove (modal) (default '"')
|
||||||
tag
|
tag
|
||||||
tag-toggle (default 't')
|
tag-toggle (default 't')
|
||||||
|
echo
|
||||||
|
echomsg
|
||||||
|
echoerr
|
||||||
|
cd
|
||||||
|
select
|
||||||
|
source
|
||||||
|
push
|
||||||
addcustominfo
|
addcustominfo
|
||||||
|
calcdirsize
|
||||||
|
clearmaps
|
||||||
tty-write
|
tty-write
|
||||||
|
visual (default 'V')
|
||||||
|
|
||||||
The following Visual mode commands are provided by lf:
|
The following Visual mode commands are provided by lf:
|
||||||
|
|
||||||
@@ -114,6 +114,7 @@ The following Visual mode commands are provided by lf:
|
|||||||
|
|
||||||
The following Command-line mode commands are provided by lf:
|
The following Command-line mode commands are provided by lf:
|
||||||
|
|
||||||
|
cmd-insert
|
||||||
cmd-escape (default '<esc>')
|
cmd-escape (default '<esc>')
|
||||||
cmd-complete (default '<tab>')
|
cmd-complete (default '<tab>')
|
||||||
cmd-menu-complete
|
cmd-menu-complete
|
||||||
@@ -414,27 +415,6 @@ Move the current file selection to the high/middle/low of the screen.
|
|||||||
|
|
||||||
Toggle the selection of the current file or files given as arguments.
|
Toggle the selection of the current file or files given as arguments.
|
||||||
|
|
||||||
## visual (default `V`)
|
|
||||||
|
|
||||||
Switch to Visual mode.
|
|
||||||
If already in Visual mode, discard the visual selection and stay in Visual mode.
|
|
||||||
|
|
||||||
## visual-accept (default `V`)
|
|
||||||
|
|
||||||
Add the visual selection to the selection list, quit Visual mode and return to Normal mode.
|
|
||||||
|
|
||||||
## visual-unselect
|
|
||||||
|
|
||||||
Remove the visual selection from the selection list, quit Visual mode and return to Normal mode.
|
|
||||||
|
|
||||||
## visual-discard (default `<esc>`)
|
|
||||||
|
|
||||||
Discard the visual selection, quit Visual mode and return to Normal mode.
|
|
||||||
|
|
||||||
## visual-change (default `o`)
|
|
||||||
|
|
||||||
Go to the other end of the current Visual mode selection.
|
|
||||||
|
|
||||||
## invert (default `v`)
|
## invert (default `v`)
|
||||||
|
|
||||||
Reverse the selection of all files in the current directory (i.e. `toggle` all files).
|
Reverse the selection of all files in the current directory (i.e. `toggle` all files).
|
||||||
@@ -449,18 +429,6 @@ Remove the selection of all files in all directories.
|
|||||||
|
|
||||||
Select/unselect files that match the given glob.
|
Select/unselect files that match the given glob.
|
||||||
|
|
||||||
## calcdirsize
|
|
||||||
|
|
||||||
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.
|
|
||||||
If the total size of a directory is not calculated, it will be shown as `-`.
|
|
||||||
|
|
||||||
## clearmaps
|
|
||||||
|
|
||||||
Remove all keybindings associated with the `map`, `nmap` and `vmap` command.
|
|
||||||
This command can be used in the config file to remove the default keybindings.
|
|
||||||
For safety purposes, `:` is left mapped to the `read` command, and `cmap` keybindings are retained so that it is still possible to exit `lf` using `:quit`.
|
|
||||||
|
|
||||||
## copy (default `y`)
|
## copy (default `y`)
|
||||||
|
|
||||||
If there are no selections, save the path of the current file to the copy buffer, otherwise, copy the paths of selected files.
|
If there are no selections, save the path of the current file to the copy buffer, otherwise, copy the paths of selected files.
|
||||||
@@ -501,26 +469,6 @@ This command is automatically called when required.
|
|||||||
|
|
||||||
Flush the cache and reload all files and directories.
|
Flush the cache and reload all files and directories.
|
||||||
|
|
||||||
## echo
|
|
||||||
|
|
||||||
Print the given arguments to the message line at the bottom.
|
|
||||||
|
|
||||||
## echomsg
|
|
||||||
|
|
||||||
Print the 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 as `errorfmt` and also to the log file.
|
|
||||||
|
|
||||||
## cd
|
|
||||||
|
|
||||||
Change the working directory to the given argument.
|
|
||||||
|
|
||||||
## select
|
|
||||||
|
|
||||||
Change the current file selection to the given argument.
|
|
||||||
|
|
||||||
## delete (modal)
|
## delete (modal)
|
||||||
|
|
||||||
Remove the current file or selected file(s).
|
Remove the current file or selected file(s).
|
||||||
@@ -531,14 +479,6 @@ A custom `delete` command can be defined to override this default.
|
|||||||
Rename the current file using the built-in method.
|
Rename the current file using the built-in method.
|
||||||
A custom `rename` command can be defined to override this default.
|
A custom `rename` command can be defined to override this default.
|
||||||
|
|
||||||
## source
|
|
||||||
|
|
||||||
Read the configuration file given in the argument.
|
|
||||||
|
|
||||||
## push
|
|
||||||
|
|
||||||
Simulate key pushes given in the argument.
|
|
||||||
|
|
||||||
## read (modal) (default `:`)
|
## read (modal) (default `:`)
|
||||||
|
|
||||||
Read a command to evaluate.
|
Read a command to evaluate.
|
||||||
@@ -595,19 +535,82 @@ You can define a new tag-clearing command by combining `tag` with `tag-toggle` (
|
|||||||
|
|
||||||
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.
|
||||||
|
|
||||||
|
## echo
|
||||||
|
|
||||||
|
Print the given arguments to the message line at the bottom.
|
||||||
|
|
||||||
|
## echomsg
|
||||||
|
|
||||||
|
Print the 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 as `errorfmt` and also to the log file.
|
||||||
|
|
||||||
|
## cd
|
||||||
|
|
||||||
|
Change the working directory to the given argument.
|
||||||
|
|
||||||
|
## select
|
||||||
|
|
||||||
|
Change the current file selection to the given argument.
|
||||||
|
|
||||||
|
## source
|
||||||
|
|
||||||
|
Read the configuration file given in the argument.
|
||||||
|
|
||||||
|
## push
|
||||||
|
|
||||||
|
Simulate key pushes given in the argument.
|
||||||
|
|
||||||
## addcustominfo
|
## addcustominfo
|
||||||
|
|
||||||
Update the `custom` info field of the given file with the given string.
|
Update the `custom` info field of the given file with the given string.
|
||||||
The info string may contain ANSI escape codes to further customize its appearance.
|
The info string may contain ANSI escape codes to further customize its appearance.
|
||||||
If no info is provided, clear the file's info instead.
|
If no info is provided, clear the file's info instead.
|
||||||
|
|
||||||
|
## calcdirsize
|
||||||
|
|
||||||
|
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.
|
||||||
|
If the total size of a directory is not calculated, it will be shown as `-`.
|
||||||
|
|
||||||
|
## clearmaps
|
||||||
|
|
||||||
|
Remove all keybindings associated with the `map`, `nmap` and `vmap` command.
|
||||||
|
This command can be used in the config file to remove the default keybindings.
|
||||||
|
For safety purposes, `:` is left mapped to the `read` command, and `cmap` keybindings are retained so that it is still possible to exit `lf` using `:quit`.
|
||||||
|
|
||||||
## tty-write
|
## tty-write
|
||||||
|
|
||||||
Write the given string to the tty.
|
Write the given string to the tty.
|
||||||
This is useful for sending escape sequences to the terminal to control its behavior (e.g. OSC 0 to set the window title).
|
This is useful for sending escape sequences to the terminal to control its behavior (e.g. OSC 0 to set the window title).
|
||||||
Using `tty-write` is preferred over directly writing to `/dev/tty` because the latter is not synchronized and can interfere with drawing the UI.
|
Using `tty-write` is preferred over directly writing to `/dev/tty` because the latter is not synchronized and can interfere with drawing the UI.
|
||||||
|
|
||||||
# COMMAND LINE COMMANDS
|
## visual (default `V`)
|
||||||
|
|
||||||
|
Switch to Visual mode.
|
||||||
|
If already in Visual mode, discard the visual selection and stay in Visual mode.
|
||||||
|
|
||||||
|
# VISUAL MODE COMMANDS
|
||||||
|
|
||||||
|
## visual-accept (default `V`)
|
||||||
|
|
||||||
|
Add the visual selection to the selection list, quit Visual mode and return to Normal mode.
|
||||||
|
|
||||||
|
## visual-unselect
|
||||||
|
|
||||||
|
Remove the visual selection from the selection list, quit Visual mode and return to Normal mode.
|
||||||
|
|
||||||
|
## visual-discard (default `<esc>`)
|
||||||
|
|
||||||
|
Discard the visual selection, quit Visual mode and return to Normal mode.
|
||||||
|
|
||||||
|
## visual-change (default `o`)
|
||||||
|
|
||||||
|
Go to the other end of the current Visual mode selection.
|
||||||
|
|
||||||
|
# COMMAND-LINE MODE COMMANDS
|
||||||
|
|
||||||
The prompt character specifies which of the several Command-line modes you are in.
|
The prompt character specifies which of the several Command-line modes you are in.
|
||||||
For example, the `read` command takes you to the `:` mode.
|
For example, the `read` command takes you to the `:` mode.
|
||||||
@@ -618,6 +621,11 @@ You can go back with `cmd-delete-back` (`<backspace>` by default).
|
|||||||
The command line commands should be mostly compatible with readline keybindings.
|
The command line commands should be mostly compatible with readline keybindings.
|
||||||
A character refers to a Unicode code point, a word consists of letters and digits, and a unix word consists of any non-blank characters.
|
A character refers to a Unicode code point, a word consists of letters and digits, and a unix word consists of any non-blank characters.
|
||||||
|
|
||||||
|
## cmd-insert
|
||||||
|
|
||||||
|
Insert the character given in the argument.
|
||||||
|
This command is automatically called when required.
|
||||||
|
|
||||||
## cmd-escape (default `<esc>`)
|
## cmd-escape (default `<esc>`)
|
||||||
|
|
||||||
Quit Command-line mode and return to Normal mode.
|
Quit Command-line mode and return to Normal mode.
|
||||||
|
|||||||
@@ -47,13 +47,10 @@ The following commands are provided by lf:
|
|||||||
middle (default 'M')
|
middle (default 'M')
|
||||||
low (default 'L')
|
low (default 'L')
|
||||||
toggle
|
toggle
|
||||||
visual (default 'V')
|
|
||||||
invert (default 'v')
|
invert (default 'v')
|
||||||
unselect (default 'u')
|
unselect (default 'u')
|
||||||
glob-select
|
glob-select
|
||||||
glob-unselect
|
glob-unselect
|
||||||
calcdirsize
|
|
||||||
clearmaps
|
|
||||||
copy (default 'y')
|
copy (default 'y')
|
||||||
cut (default 'd')
|
cut (default 'd')
|
||||||
paste (default 'p')
|
paste (default 'p')
|
||||||
@@ -63,15 +60,8 @@ The following commands are provided by lf:
|
|||||||
redraw (default '<c-l>')
|
redraw (default '<c-l>')
|
||||||
load
|
load
|
||||||
reload (default '<c-r>')
|
reload (default '<c-r>')
|
||||||
echo
|
|
||||||
echomsg
|
|
||||||
echoerr
|
|
||||||
cd
|
|
||||||
select
|
|
||||||
delete (modal)
|
delete (modal)
|
||||||
rename (modal) (default 'r')
|
rename (modal) (default 'r')
|
||||||
source
|
|
||||||
push
|
|
||||||
read (modal) (default ':')
|
read (modal) (default ':')
|
||||||
shell (modal) (default '$')
|
shell (modal) (default '$')
|
||||||
shell-pipe (modal) (default '%')
|
shell-pipe (modal) (default '%')
|
||||||
@@ -92,8 +82,18 @@ The following commands are provided by lf:
|
|||||||
mark-remove (modal) (default '"')
|
mark-remove (modal) (default '"')
|
||||||
tag
|
tag
|
||||||
tag-toggle (default 't')
|
tag-toggle (default 't')
|
||||||
|
echo
|
||||||
|
echomsg
|
||||||
|
echoerr
|
||||||
|
cd
|
||||||
|
select
|
||||||
|
source
|
||||||
|
push
|
||||||
addcustominfo
|
addcustominfo
|
||||||
|
calcdirsize
|
||||||
|
clearmaps
|
||||||
tty-write
|
tty-write
|
||||||
|
visual (default 'V')
|
||||||
|
|
||||||
The following Visual mode commands are provided by lf:
|
The following Visual mode commands are provided by lf:
|
||||||
|
|
||||||
@@ -104,6 +104,7 @@ The following Visual mode commands are provided by lf:
|
|||||||
|
|
||||||
The following Command-line mode commands are provided by lf:
|
The following Command-line mode commands are provided by lf:
|
||||||
|
|
||||||
|
cmd-insert
|
||||||
cmd-escape (default '<esc>')
|
cmd-escape (default '<esc>')
|
||||||
cmd-complete (default '<tab>')
|
cmd-complete (default '<tab>')
|
||||||
cmd-menu-complete
|
cmd-menu-complete
|
||||||
@@ -413,30 +414,6 @@ toggle
|
|||||||
|
|
||||||
Toggle the selection of the current file or files given as arguments.
|
Toggle the selection of the current file or files given as arguments.
|
||||||
|
|
||||||
visual (default V)
|
|
||||||
|
|
||||||
Switch to Visual mode. If already in Visual mode, discard the visual
|
|
||||||
selection and stay in Visual mode.
|
|
||||||
|
|
||||||
visual-accept (default V)
|
|
||||||
|
|
||||||
Add the visual selection to the selection list, quit Visual mode and
|
|
||||||
return to Normal mode.
|
|
||||||
|
|
||||||
visual-unselect
|
|
||||||
|
|
||||||
Remove the visual selection from the selection list, quit Visual mode
|
|
||||||
and return to Normal mode.
|
|
||||||
|
|
||||||
visual-discard (default <esc>)
|
|
||||||
|
|
||||||
Discard the visual selection, quit Visual mode and return to Normal
|
|
||||||
mode.
|
|
||||||
|
|
||||||
visual-change (default o)
|
|
||||||
|
|
||||||
Go to the other end of the current Visual mode selection.
|
|
||||||
|
|
||||||
invert (default v)
|
invert (default v)
|
||||||
|
|
||||||
Reverse the selection of all files in the current directory (i.e. toggle
|
Reverse the selection of all files in the current directory (i.e. toggle
|
||||||
@@ -454,21 +431,6 @@ glob-select, glob-unselect
|
|||||||
|
|
||||||
Select/unselect files that match the given glob.
|
Select/unselect files that match the given glob.
|
||||||
|
|
||||||
calcdirsize
|
|
||||||
|
|
||||||
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. If the total size of a directory is not calculated, it will
|
|
||||||
be shown as -.
|
|
||||||
|
|
||||||
clearmaps
|
|
||||||
|
|
||||||
Remove all keybindings associated with the map, nmap and vmap command.
|
|
||||||
This command can be used in the config file to remove the default
|
|
||||||
keybindings. For safety purposes, : is left mapped to the read command,
|
|
||||||
and cmap keybindings are retained so that it is still possible to exit
|
|
||||||
lf using :quit.
|
|
||||||
|
|
||||||
copy (default y)
|
copy (default y)
|
||||||
|
|
||||||
If there are no selections, save the path of the current file to the
|
If there are no selections, save the path of the current file to the
|
||||||
@@ -510,28 +472,6 @@ reload (default <c-r>)
|
|||||||
|
|
||||||
Flush the cache and reload all files and directories.
|
Flush the cache and reload all files and directories.
|
||||||
|
|
||||||
echo
|
|
||||||
|
|
||||||
Print the given arguments to the message line at the bottom.
|
|
||||||
|
|
||||||
echomsg
|
|
||||||
|
|
||||||
Print the 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 as errorfmt and
|
|
||||||
also to the log file.
|
|
||||||
|
|
||||||
cd
|
|
||||||
|
|
||||||
Change the working directory to the given argument.
|
|
||||||
|
|
||||||
select
|
|
||||||
|
|
||||||
Change the current file selection to the given argument.
|
|
||||||
|
|
||||||
delete (modal)
|
delete (modal)
|
||||||
|
|
||||||
Remove the current file or selected file(s). A custom delete command can
|
Remove the current file or selected file(s). A custom delete command can
|
||||||
@@ -542,14 +482,6 @@ rename (modal) (default r)
|
|||||||
Rename the current file using the built-in method. A custom rename
|
Rename the current file using the built-in method. A custom rename
|
||||||
command can be defined to override this default.
|
command can be defined to override this default.
|
||||||
|
|
||||||
source
|
|
||||||
|
|
||||||
Read the configuration file given in the argument.
|
|
||||||
|
|
||||||
push
|
|
||||||
|
|
||||||
Simulate key pushes given in the argument.
|
|
||||||
|
|
||||||
read (modal) (default :)
|
read (modal) (default :)
|
||||||
|
|
||||||
Read a command to evaluate.
|
Read a command to evaluate.
|
||||||
@@ -613,12 +545,57 @@ tag-toggle (default t)
|
|||||||
Tag a file with * or a single width character given in the argument if
|
Tag a file with * or a single width character given in the argument if
|
||||||
the file is untagged, otherwise remove the tag.
|
the file is untagged, otherwise remove the tag.
|
||||||
|
|
||||||
|
echo
|
||||||
|
|
||||||
|
Print the given arguments to the message line at the bottom.
|
||||||
|
|
||||||
|
echomsg
|
||||||
|
|
||||||
|
Print the 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 as errorfmt and
|
||||||
|
also to the log file.
|
||||||
|
|
||||||
|
cd
|
||||||
|
|
||||||
|
Change the working directory to the given argument.
|
||||||
|
|
||||||
|
select
|
||||||
|
|
||||||
|
Change the current file selection to the given argument.
|
||||||
|
|
||||||
|
source
|
||||||
|
|
||||||
|
Read the configuration file given in the argument.
|
||||||
|
|
||||||
|
push
|
||||||
|
|
||||||
|
Simulate key pushes given in the argument.
|
||||||
|
|
||||||
addcustominfo
|
addcustominfo
|
||||||
|
|
||||||
Update the custom info field of the given file with the given string.
|
Update the custom info field of the given file with the given string.
|
||||||
The info string may contain ANSI escape codes to further customize its
|
The info string may contain ANSI escape codes to further customize its
|
||||||
appearance. If no info is provided, clear the file's info instead.
|
appearance. If no info is provided, clear the file's info instead.
|
||||||
|
|
||||||
|
calcdirsize
|
||||||
|
|
||||||
|
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. If the total size of a directory is not calculated, it will
|
||||||
|
be shown as -.
|
||||||
|
|
||||||
|
clearmaps
|
||||||
|
|
||||||
|
Remove all keybindings associated with the map, nmap and vmap command.
|
||||||
|
This command can be used in the config file to remove the default
|
||||||
|
keybindings. For safety purposes, : is left mapped to the read command,
|
||||||
|
and cmap keybindings are retained so that it is still possible to exit
|
||||||
|
lf using :quit.
|
||||||
|
|
||||||
tty-write
|
tty-write
|
||||||
|
|
||||||
Write the given string to the tty. This is useful for sending escape
|
Write the given string to the tty. This is useful for sending escape
|
||||||
@@ -627,7 +604,33 @@ window title). Using tty-write is preferred over directly writing to
|
|||||||
/dev/tty because the latter is not synchronized and can interfere with
|
/dev/tty because the latter is not synchronized and can interfere with
|
||||||
drawing the UI.
|
drawing the UI.
|
||||||
|
|
||||||
COMMAND LINE COMMANDS
|
visual (default V)
|
||||||
|
|
||||||
|
Switch to Visual mode. If already in Visual mode, discard the visual
|
||||||
|
selection and stay in Visual mode.
|
||||||
|
|
||||||
|
VISUAL MODE COMMANDS
|
||||||
|
|
||||||
|
visual-accept (default V)
|
||||||
|
|
||||||
|
Add the visual selection to the selection list, quit Visual mode and
|
||||||
|
return to Normal mode.
|
||||||
|
|
||||||
|
visual-unselect
|
||||||
|
|
||||||
|
Remove the visual selection from the selection list, quit Visual mode
|
||||||
|
and return to Normal mode.
|
||||||
|
|
||||||
|
visual-discard (default <esc>)
|
||||||
|
|
||||||
|
Discard the visual selection, quit Visual mode and return to Normal
|
||||||
|
mode.
|
||||||
|
|
||||||
|
visual-change (default o)
|
||||||
|
|
||||||
|
Go to the other end of the current Visual mode selection.
|
||||||
|
|
||||||
|
COMMAND-LINE MODE COMMANDS
|
||||||
|
|
||||||
The prompt character specifies which of the several Command-line modes
|
The prompt character specifies which of the several Command-line modes
|
||||||
you are in. For example, the read command takes you to the : mode.
|
you are in. For example, the read command takes you to the : mode.
|
||||||
@@ -641,6 +644,11 @@ 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
|
of letters and digits, and a unix word consists of any non-blank
|
||||||
characters.
|
characters.
|
||||||
|
|
||||||
|
cmd-insert
|
||||||
|
|
||||||
|
Insert the character given in the argument. This command is
|
||||||
|
automatically called when required.
|
||||||
|
|
||||||
cmd-escape (default <esc>)
|
cmd-escape (default <esc>)
|
||||||
|
|
||||||
Quit Command-line mode and return to Normal mode.
|
Quit Command-line mode and return to Normal mode.
|
||||||
|
|||||||
@@ -1071,6 +1071,8 @@ func (e *callExpr) eval(app *app, args []string) {
|
|||||||
os.Setenv("lf_count", strconv.Itoa(e.count))
|
os.Setenv("lf_count", strconv.Itoa(e.count))
|
||||||
|
|
||||||
switch e.name {
|
switch e.name {
|
||||||
|
case "quit":
|
||||||
|
app.quitChan <- struct{}{}
|
||||||
case "up":
|
case "up":
|
||||||
if !app.nav.init {
|
if !app.nav.init {
|
||||||
return
|
return
|
||||||
@@ -1127,19 +1129,6 @@ func (e *callExpr) eval(app *app, args []string) {
|
|||||||
app.ui.loadFile(app, true)
|
app.ui.loadFile(app, true)
|
||||||
app.ui.loadFileInfo(app.nav)
|
app.ui.loadFileInfo(app.nav)
|
||||||
}
|
}
|
||||||
case "tty-write":
|
|
||||||
if len(e.args) != 1 {
|
|
||||||
app.ui.echoerr("tty-write: requires an argument")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
tty, ok := app.ui.screen.Tty()
|
|
||||||
if !ok {
|
|
||||||
log.Printf("tty-write: failed to get tty")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
tty.Write([]byte(e.args[0]))
|
|
||||||
case "scroll-down":
|
case "scroll-down":
|
||||||
if !app.nav.init {
|
if !app.nav.init {
|
||||||
return
|
return
|
||||||
@@ -1200,16 +1189,6 @@ func (e *callExpr) eval(app *app, args []string) {
|
|||||||
if cmd, ok := gOpts.cmds["open"]; ok {
|
if cmd, ok := gOpts.cmds["open"]; ok {
|
||||||
cmd.eval(app, e.args)
|
cmd.eval(app, e.args)
|
||||||
}
|
}
|
||||||
case "jump-prev":
|
|
||||||
resetIncCmd(app)
|
|
||||||
preChdir(app)
|
|
||||||
for range e.count {
|
|
||||||
app.nav.cdJumpListPrev()
|
|
||||||
}
|
|
||||||
app.ui.loadFile(app, true)
|
|
||||||
app.ui.loadFileInfo(app.nav)
|
|
||||||
restartIncCmd(app)
|
|
||||||
onChdir(app)
|
|
||||||
case "jump-next":
|
case "jump-next":
|
||||||
resetIncCmd(app)
|
resetIncCmd(app)
|
||||||
preChdir(app)
|
preChdir(app)
|
||||||
@@ -1220,8 +1199,16 @@ func (e *callExpr) eval(app *app, args []string) {
|
|||||||
app.ui.loadFileInfo(app.nav)
|
app.ui.loadFileInfo(app.nav)
|
||||||
restartIncCmd(app)
|
restartIncCmd(app)
|
||||||
onChdir(app)
|
onChdir(app)
|
||||||
case "quit":
|
case "jump-prev":
|
||||||
app.quitChan <- struct{}{}
|
resetIncCmd(app)
|
||||||
|
preChdir(app)
|
||||||
|
for range e.count {
|
||||||
|
app.nav.cdJumpListPrev()
|
||||||
|
}
|
||||||
|
app.ui.loadFile(app, true)
|
||||||
|
app.ui.loadFileInfo(app.nav)
|
||||||
|
restartIncCmd(app)
|
||||||
|
onChdir(app)
|
||||||
case "top":
|
case "top":
|
||||||
if !app.nav.init {
|
if !app.nav.init {
|
||||||
return
|
return
|
||||||
@@ -1296,56 +1283,6 @@ func (e *callExpr) eval(app *app, args []string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "tag-toggle":
|
|
||||||
if !app.nav.init {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
tag := "*"
|
|
||||||
if len(e.args) != 0 {
|
|
||||||
tag = e.args[0]
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := app.nav.tagToggle(tag); err != nil {
|
|
||||||
app.ui.echoerrf("tag-toggle: %s", err)
|
|
||||||
} else if err := app.nav.writeTags(); err != nil {
|
|
||||||
app.ui.echoerrf("tag-toggle: %s", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if gSingleMode {
|
|
||||||
if err := app.nav.sync(); err != nil {
|
|
||||||
app.ui.echoerrf("tag-toggle: %s", err)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if err := remote("send sync"); err != nil {
|
|
||||||
app.ui.echoerrf("tag-toggle: %s", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case "tag":
|
|
||||||
if !app.nav.init {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
tag := "*"
|
|
||||||
if len(e.args) != 0 {
|
|
||||||
tag = e.args[0]
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := app.nav.tag(tag); err != nil {
|
|
||||||
app.ui.echoerrf("tag: %s", err)
|
|
||||||
} else if err := app.nav.writeTags(); err != nil {
|
|
||||||
app.ui.echoerrf("tag: %s", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if gSingleMode {
|
|
||||||
if err := app.nav.sync(); err != nil {
|
|
||||||
app.ui.echoerrf("tag: %s", err)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if err := remote("send sync"); err != nil {
|
|
||||||
app.ui.echoerrf("tag: %s", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case "invert":
|
case "invert":
|
||||||
if !app.nav.init {
|
if !app.nav.init {
|
||||||
return
|
return
|
||||||
@@ -1353,24 +1290,30 @@ func (e *callExpr) eval(app *app, args []string) {
|
|||||||
app.nav.invert()
|
app.nav.invert()
|
||||||
case "unselect":
|
case "unselect":
|
||||||
app.nav.unselect()
|
app.nav.unselect()
|
||||||
case "calcdirsize":
|
case "glob-select":
|
||||||
if !app.nav.init {
|
if !app.nav.init {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err := app.nav.calcDirSize()
|
if len(e.args) != 1 {
|
||||||
if err != nil {
|
app.ui.echoerr("glob-select: requires a pattern to match")
|
||||||
app.ui.echoerrf("calcdirsize: %s", err)
|
return
|
||||||
|
}
|
||||||
|
if err := app.nav.globSel(e.args[0], false); err != nil {
|
||||||
|
app.ui.echoerrf("%s", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
case "glob-unselect":
|
||||||
|
if !app.nav.init {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if len(e.args) != 1 {
|
||||||
|
app.ui.echoerr("glob-unselect: requires a pattern to match")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := app.nav.globSel(e.args[0], true); err != nil {
|
||||||
|
app.ui.echoerrf("%s", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
app.ui.loadFileInfo(app.nav)
|
|
||||||
app.nav.sort()
|
|
||||||
app.ui.sort()
|
|
||||||
case "clearmaps":
|
|
||||||
// leave `:` and cmaps bound so the user can still exit using `:quit`
|
|
||||||
clear(gOpts.nkeys)
|
|
||||||
clear(gOpts.vkeys)
|
|
||||||
gOpts.nkeys[":"] = &callExpr{"read", nil, 1}
|
|
||||||
gOpts.vkeys[":"] = &callExpr{"read", nil, 1}
|
|
||||||
case "copy":
|
case "copy":
|
||||||
if !app.nav.init {
|
if !app.nav.init {
|
||||||
return
|
return
|
||||||
@@ -1428,6 +1371,65 @@ func (e *callExpr) eval(app *app, args []string) {
|
|||||||
}
|
}
|
||||||
app.ui.loadFile(app, true)
|
app.ui.loadFile(app, true)
|
||||||
app.ui.loadFileInfo(app.nav)
|
app.ui.loadFileInfo(app.nav)
|
||||||
|
case "clear":
|
||||||
|
if !app.nav.init {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := saveFiles(nil, false); err != nil {
|
||||||
|
app.ui.echoerrf("clear: %s", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if gSingleMode {
|
||||||
|
if err := app.nav.sync(); err != nil {
|
||||||
|
app.ui.echoerrf("clear: %s", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if err := remote("send sync"); err != nil {
|
||||||
|
app.ui.echoerrf("clear: %s", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
app.ui.loadFileInfo(app.nav)
|
||||||
|
case "sync":
|
||||||
|
if err := app.nav.sync(); err != nil {
|
||||||
|
app.ui.echoerrf("sync: %s", err)
|
||||||
|
}
|
||||||
|
case "draw":
|
||||||
|
case "redraw":
|
||||||
|
if !app.nav.init {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
app.ui.renew()
|
||||||
|
app.ui.screen.Sync()
|
||||||
|
if app.nav.height != app.ui.wins[0].h {
|
||||||
|
app.nav.height = app.ui.wins[0].h
|
||||||
|
clear(app.nav.regCache)
|
||||||
|
}
|
||||||
|
if gOpts.sixel {
|
||||||
|
clear(app.nav.regCache)
|
||||||
|
app.ui.sxScreen.forceClear = true
|
||||||
|
}
|
||||||
|
for _, dir := range app.nav.dirs {
|
||||||
|
dir.boundPos(app.nav.height)
|
||||||
|
}
|
||||||
|
app.ui.loadFile(app, true)
|
||||||
|
onRedraw(app)
|
||||||
|
case "load":
|
||||||
|
if !app.nav.init || gOpts.watch {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
app.nav.renew()
|
||||||
|
app.ui.loadFile(app, false)
|
||||||
|
case "reload":
|
||||||
|
if !app.nav.init {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := app.nav.reload(); err != nil {
|
||||||
|
app.ui.echoerrf("reload: %s", err)
|
||||||
|
}
|
||||||
|
app.ui.loadFile(app, true)
|
||||||
|
app.ui.loadFileInfo(app.nav)
|
||||||
case "delete":
|
case "delete":
|
||||||
if !app.nav.init {
|
if !app.nav.init {
|
||||||
return
|
return
|
||||||
@@ -1463,61 +1465,42 @@ func (e *callExpr) eval(app *app, args []string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
app.ui.loadFileInfo(app.nav)
|
app.ui.loadFileInfo(app.nav)
|
||||||
case "clear":
|
case "rename":
|
||||||
if !app.nav.init {
|
if !app.nav.init {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if err := saveFiles(nil, false); err != nil {
|
if cmd, ok := gOpts.cmds["rename"]; ok {
|
||||||
app.ui.echoerrf("clear: %s", err)
|
cmd.eval(app, e.args)
|
||||||
return
|
if gSingleMode {
|
||||||
}
|
app.nav.renew()
|
||||||
if gSingleMode {
|
app.ui.loadFile(app, true)
|
||||||
if err := app.nav.sync(); err != nil {
|
} else {
|
||||||
app.ui.echoerrf("clear: %s", err)
|
if err := remote("send load"); err != nil {
|
||||||
return
|
app.ui.echoerrf("rename: %s", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if err := remote("send sync"); err != nil {
|
curr, err := app.nav.currFile()
|
||||||
app.ui.echoerrf("clear: %s", err)
|
if err != nil {
|
||||||
|
app.ui.echoerrf("rename: %s:", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if app.ui.cmdPrefix == ">" {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
normal(app)
|
||||||
|
app.ui.cmdPrefix = "rename: "
|
||||||
|
extension := getFileExtension(curr)
|
||||||
|
if len(extension) == 0 {
|
||||||
|
// no extension or .hidden or is directory
|
||||||
|
app.ui.cmdAccLeft = append(app.ui.cmdAccLeft, []rune(curr.Name())...)
|
||||||
|
} else {
|
||||||
|
app.ui.cmdAccLeft = append(app.ui.cmdAccLeft, []rune(curr.Name()[:len(curr.Name())-len(extension)])...)
|
||||||
|
app.ui.cmdAccRight = append(app.ui.cmdAccRight, []rune(extension)...)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
app.ui.loadFileInfo(app.nav)
|
app.ui.loadFileInfo(app.nav)
|
||||||
case "draw":
|
|
||||||
case "redraw":
|
|
||||||
if !app.nav.init {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
app.ui.renew()
|
|
||||||
app.ui.screen.Sync()
|
|
||||||
if app.nav.height != app.ui.wins[0].h {
|
|
||||||
app.nav.height = app.ui.wins[0].h
|
|
||||||
clear(app.nav.regCache)
|
|
||||||
}
|
|
||||||
if gOpts.sixel {
|
|
||||||
clear(app.nav.regCache)
|
|
||||||
app.ui.sxScreen.forceClear = true
|
|
||||||
}
|
|
||||||
for _, dir := range app.nav.dirs {
|
|
||||||
dir.boundPos(app.nav.height)
|
|
||||||
}
|
|
||||||
app.ui.loadFile(app, true)
|
|
||||||
onRedraw(app)
|
|
||||||
case "load":
|
|
||||||
if !app.nav.init || gOpts.watch {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
app.nav.renew()
|
|
||||||
app.ui.loadFile(app, false)
|
|
||||||
case "reload":
|
|
||||||
if !app.nav.init {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := app.nav.reload(); err != nil {
|
|
||||||
app.ui.echoerrf("reload: %s", err)
|
|
||||||
}
|
|
||||||
app.ui.loadFile(app, true)
|
|
||||||
app.ui.loadFileInfo(app.nav)
|
|
||||||
case "read":
|
case "read":
|
||||||
if app.ui.cmdPrefix == ">" {
|
if app.ui.cmdPrefix == ">" {
|
||||||
return
|
return
|
||||||
@@ -1720,45 +1703,55 @@ func (e *callExpr) eval(app *app, args []string) {
|
|||||||
normal(app)
|
normal(app)
|
||||||
app.ui.menu = listMarks(app.nav.marks)
|
app.ui.menu = listMarks(app.nav.marks)
|
||||||
app.ui.cmdPrefix = "mark-remove: "
|
app.ui.cmdPrefix = "mark-remove: "
|
||||||
case "rename":
|
case "tag":
|
||||||
if !app.nav.init {
|
if !app.nav.init {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if cmd, ok := gOpts.cmds["rename"]; ok {
|
|
||||||
cmd.eval(app, e.args)
|
tag := "*"
|
||||||
if gSingleMode {
|
if len(e.args) != 0 {
|
||||||
app.nav.renew()
|
tag = e.args[0]
|
||||||
app.ui.loadFile(app, true)
|
}
|
||||||
} else {
|
|
||||||
if err := remote("send load"); err != nil {
|
if err := app.nav.tag(tag); err != nil {
|
||||||
app.ui.echoerrf("rename: %s", err)
|
app.ui.echoerrf("tag: %s", err)
|
||||||
return
|
} else if err := app.nav.writeTags(); err != nil {
|
||||||
}
|
app.ui.echoerrf("tag: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if gSingleMode {
|
||||||
|
if err := app.nav.sync(); err != nil {
|
||||||
|
app.ui.echoerrf("tag: %s", err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
curr, err := app.nav.currFile()
|
if err := remote("send sync"); err != nil {
|
||||||
if err != nil {
|
app.ui.echoerrf("tag: %s", err)
|
||||||
app.ui.echoerrf("rename: %s:", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if app.ui.cmdPrefix == ">" {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
normal(app)
|
|
||||||
app.ui.cmdPrefix = "rename: "
|
|
||||||
extension := getFileExtension(curr)
|
|
||||||
if len(extension) == 0 {
|
|
||||||
// no extension or .hidden or is directory
|
|
||||||
app.ui.cmdAccLeft = append(app.ui.cmdAccLeft, []rune(curr.Name())...)
|
|
||||||
} else {
|
|
||||||
app.ui.cmdAccLeft = append(app.ui.cmdAccLeft, []rune(curr.Name()[:len(curr.Name())-len(extension)])...)
|
|
||||||
app.ui.cmdAccRight = append(app.ui.cmdAccRight, []rune(extension)...)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
app.ui.loadFileInfo(app.nav)
|
case "tag-toggle":
|
||||||
case "sync":
|
if !app.nav.init {
|
||||||
if err := app.nav.sync(); err != nil {
|
return
|
||||||
app.ui.echoerrf("sync: %s", err)
|
}
|
||||||
|
|
||||||
|
tag := "*"
|
||||||
|
if len(e.args) != 0 {
|
||||||
|
tag = e.args[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := app.nav.tagToggle(tag); err != nil {
|
||||||
|
app.ui.echoerrf("tag-toggle: %s", err)
|
||||||
|
} else if err := app.nav.writeTags(); err != nil {
|
||||||
|
app.ui.echoerrf("tag-toggle: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if gSingleMode {
|
||||||
|
if err := app.nav.sync(); err != nil {
|
||||||
|
app.ui.echoerrf("tag-toggle: %s", err)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if err := remote("send sync"); err != nil {
|
||||||
|
app.ui.echoerrf("tag-toggle: %s", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
case "echo":
|
case "echo":
|
||||||
app.ui.echo(strings.Join(e.args, " "))
|
app.ui.echo(strings.Join(e.args, " "))
|
||||||
@@ -1842,30 +1835,6 @@ func (e *callExpr) eval(app *app, args []string) {
|
|||||||
restartIncCmd(app)
|
restartIncCmd(app)
|
||||||
onChdir(app)
|
onChdir(app)
|
||||||
}
|
}
|
||||||
case "glob-select":
|
|
||||||
if !app.nav.init {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if len(e.args) != 1 {
|
|
||||||
app.ui.echoerr("glob-select: requires a pattern to match")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := app.nav.globSel(e.args[0], false); err != nil {
|
|
||||||
app.ui.echoerrf("%s", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
case "glob-unselect":
|
|
||||||
if !app.nav.init {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if len(e.args) != 1 {
|
|
||||||
app.ui.echoerr("glob-unselect: requires a pattern to match")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := app.nav.globSel(e.args[0], true); err != nil {
|
|
||||||
app.ui.echoerrf("%s", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
case "source":
|
case "source":
|
||||||
if len(e.args) != 1 {
|
if len(e.args) != 1 {
|
||||||
app.ui.echoerr("source: requires an argument")
|
app.ui.echoerr("source: requires an argument")
|
||||||
@@ -1882,12 +1851,134 @@ func (e *callExpr) eval(app *app, args []string) {
|
|||||||
for _, val := range splitKeys(e.args[0]) {
|
for _, val := range splitKeys(e.args[0]) {
|
||||||
app.ui.keyChan <- val
|
app.ui.keyChan <- val
|
||||||
}
|
}
|
||||||
case "on-focus-gained":
|
case "addcustominfo":
|
||||||
onFocusGained(app)
|
var k, v string
|
||||||
case "on-focus-lost":
|
switch len(e.args) {
|
||||||
onFocusLost(app)
|
case 1:
|
||||||
case "on-init":
|
k, v = e.args[0], ""
|
||||||
onInit(app)
|
case 2:
|
||||||
|
k, v = e.args[0], e.args[1]
|
||||||
|
default:
|
||||||
|
app.ui.echoerr("addcustominfo: requires either 1 or 2 arguments")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
path, err := filepath.Abs(replaceTilde(k))
|
||||||
|
if err != nil {
|
||||||
|
app.ui.echoerrf("addcustominfo: %s", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
dir := filepath.Dir(path)
|
||||||
|
d, ok := app.nav.dirCache[dir]
|
||||||
|
if !ok {
|
||||||
|
app.ui.echoerrf("addcustominfo: dir not loaded: %s", dir)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var f *file
|
||||||
|
for _, file := range d.allFiles {
|
||||||
|
if file.path == path {
|
||||||
|
f = file
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if f == nil {
|
||||||
|
app.ui.echoerrf("addcustominfo: file not found: %s", path)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(strings.Trim(v, " ")) == 0 {
|
||||||
|
v = ""
|
||||||
|
}
|
||||||
|
if f.customInfo != v {
|
||||||
|
f.customInfo = v
|
||||||
|
// only sort when order changes
|
||||||
|
if getSortBy(dir) == customSort {
|
||||||
|
d.sort()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case "calcdirsize":
|
||||||
|
if !app.nav.init {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err := app.nav.calcDirSize()
|
||||||
|
if err != nil {
|
||||||
|
app.ui.echoerrf("calcdirsize: %s", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
app.ui.loadFileInfo(app.nav)
|
||||||
|
app.nav.sort()
|
||||||
|
app.ui.sort()
|
||||||
|
case "clearmaps":
|
||||||
|
// leave `:` and cmaps bound so the user can still exit using `:quit`
|
||||||
|
clear(gOpts.nkeys)
|
||||||
|
clear(gOpts.vkeys)
|
||||||
|
gOpts.nkeys[":"] = &callExpr{"read", nil, 1}
|
||||||
|
gOpts.vkeys[":"] = &callExpr{"read", nil, 1}
|
||||||
|
case "tty-write":
|
||||||
|
if len(e.args) != 1 {
|
||||||
|
app.ui.echoerr("tty-write: requires an argument")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
tty, ok := app.ui.screen.Tty()
|
||||||
|
if !ok {
|
||||||
|
log.Printf("tty-write: failed to get tty")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
tty.Write([]byte(e.args[0]))
|
||||||
|
case "visual":
|
||||||
|
if !app.nav.init {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
visual(app)
|
||||||
|
case "visual-accept":
|
||||||
|
if !app.nav.init {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
dir := app.nav.currDir()
|
||||||
|
for _, path := range dir.visualSelections() {
|
||||||
|
if _, ok := app.nav.selections[path]; !ok {
|
||||||
|
app.nav.selections[path] = app.nav.selectionInd
|
||||||
|
app.nav.selectionInd++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// resetting Visual mode here instead of inside `normal()`
|
||||||
|
// allows us to use Visual mode inside search, find etc.
|
||||||
|
dir.visualAnchor = -1
|
||||||
|
normal(app)
|
||||||
|
case "visual-unselect":
|
||||||
|
if !app.nav.init {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
dir := app.nav.currDir()
|
||||||
|
for _, path := range dir.visualSelections() {
|
||||||
|
delete(app.nav.selections, path)
|
||||||
|
}
|
||||||
|
if len(app.nav.selections) == 0 {
|
||||||
|
app.nav.selectionInd = 0
|
||||||
|
}
|
||||||
|
dir.visualAnchor = -1
|
||||||
|
normal(app)
|
||||||
|
case "visual-discard":
|
||||||
|
if !app.nav.init {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
dir := app.nav.currDir()
|
||||||
|
dir.visualAnchor = -1
|
||||||
|
normal(app)
|
||||||
|
case "visual-change":
|
||||||
|
if !app.nav.isVisualMode() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
dir := app.nav.currDir()
|
||||||
|
beg := max(dir.ind-dir.pos, 0)
|
||||||
|
dir.ind, dir.visualAnchor = dir.visualAnchor, dir.ind
|
||||||
|
dir.pos = dir.ind - beg
|
||||||
|
dir.visualWrap = -dir.visualWrap
|
||||||
|
dir.boundPos(app.nav.height)
|
||||||
case "cmd-insert":
|
case "cmd-insert":
|
||||||
if len(e.args) == 0 {
|
if len(e.args) == 0 {
|
||||||
return
|
return
|
||||||
@@ -2069,6 +2160,16 @@ func (e *callExpr) eval(app *app, args []string) {
|
|||||||
default:
|
default:
|
||||||
log.Printf("entering unknown execution prefix: %q", app.ui.cmdPrefix)
|
log.Printf("entering unknown execution prefix: %q", app.ui.cmdPrefix)
|
||||||
}
|
}
|
||||||
|
case "cmd-interrupt":
|
||||||
|
if app.cmd != nil {
|
||||||
|
err := shellKill(app.cmd)
|
||||||
|
if err != nil {
|
||||||
|
app.ui.echoerrf("kill: %s", err)
|
||||||
|
} else {
|
||||||
|
app.ui.echoerr("process interrupt")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
normal(app)
|
||||||
case "cmd-history-next":
|
case "cmd-history-next":
|
||||||
if !slices.Contains([]string{":", "$", "!", "%", "&"}, app.ui.cmdPrefix) {
|
if !slices.Contains([]string{":", "$", "!", "%", "&"}, app.ui.cmdPrefix) {
|
||||||
return
|
return
|
||||||
@@ -2100,6 +2201,24 @@ func (e *callExpr) eval(app *app, args []string) {
|
|||||||
app.cmdHistoryInd = historyInd
|
app.cmdHistoryInd = historyInd
|
||||||
app.ui.cmdPrefix = cmd.prefix
|
app.ui.cmdPrefix = cmd.prefix
|
||||||
app.ui.cmdAccLeft = []rune(cmd.value)
|
app.ui.cmdAccLeft = []rune(cmd.value)
|
||||||
|
case "cmd-left":
|
||||||
|
if len(app.ui.cmdAccLeft) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
app.ui.cmdAccRight = append([]rune{app.ui.cmdAccLeft[len(app.ui.cmdAccLeft)-1]}, app.ui.cmdAccRight...)
|
||||||
|
app.ui.cmdAccLeft = app.ui.cmdAccLeft[:len(app.ui.cmdAccLeft)-1]
|
||||||
|
case "cmd-right":
|
||||||
|
if len(app.ui.cmdAccRight) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
app.ui.cmdAccLeft = append(app.ui.cmdAccLeft, app.ui.cmdAccRight[0])
|
||||||
|
app.ui.cmdAccRight = app.ui.cmdAccRight[1:]
|
||||||
|
case "cmd-home":
|
||||||
|
app.ui.cmdAccRight = append(app.ui.cmdAccLeft, app.ui.cmdAccRight...)
|
||||||
|
app.ui.cmdAccLeft = nil
|
||||||
|
case "cmd-end":
|
||||||
|
app.ui.cmdAccLeft = append(app.ui.cmdAccLeft, app.ui.cmdAccRight...)
|
||||||
|
app.ui.cmdAccRight = nil
|
||||||
case "cmd-delete":
|
case "cmd-delete":
|
||||||
if len(app.ui.cmdAccRight) == 0 {
|
if len(app.ui.cmdAccRight) == 0 {
|
||||||
return
|
return
|
||||||
@@ -2122,24 +2241,6 @@ func (e *callExpr) eval(app *app, args []string) {
|
|||||||
}
|
}
|
||||||
app.ui.cmdAccLeft = app.ui.cmdAccLeft[:len(app.ui.cmdAccLeft)-1]
|
app.ui.cmdAccLeft = app.ui.cmdAccLeft[:len(app.ui.cmdAccLeft)-1]
|
||||||
update(app)
|
update(app)
|
||||||
case "cmd-left":
|
|
||||||
if len(app.ui.cmdAccLeft) == 0 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
app.ui.cmdAccRight = append([]rune{app.ui.cmdAccLeft[len(app.ui.cmdAccLeft)-1]}, app.ui.cmdAccRight...)
|
|
||||||
app.ui.cmdAccLeft = app.ui.cmdAccLeft[:len(app.ui.cmdAccLeft)-1]
|
|
||||||
case "cmd-right":
|
|
||||||
if len(app.ui.cmdAccRight) == 0 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
app.ui.cmdAccLeft = append(app.ui.cmdAccLeft, app.ui.cmdAccRight[0])
|
|
||||||
app.ui.cmdAccRight = app.ui.cmdAccRight[1:]
|
|
||||||
case "cmd-home":
|
|
||||||
app.ui.cmdAccRight = append(app.ui.cmdAccLeft, app.ui.cmdAccRight...)
|
|
||||||
app.ui.cmdAccLeft = nil
|
|
||||||
case "cmd-end":
|
|
||||||
app.ui.cmdAccLeft = append(app.ui.cmdAccLeft, app.ui.cmdAccRight...)
|
|
||||||
app.ui.cmdAccRight = nil
|
|
||||||
case "cmd-delete-home":
|
case "cmd-delete-home":
|
||||||
if len(app.ui.cmdAccLeft) == 0 {
|
if len(app.ui.cmdAccLeft) == 0 {
|
||||||
return
|
return
|
||||||
@@ -2168,106 +2269,6 @@ func (e *callExpr) eval(app *app, args []string) {
|
|||||||
}
|
}
|
||||||
app.ui.cmdAccLeft[len(app.ui.cmdAccLeft)-1], app.ui.cmdAccLeft[len(app.ui.cmdAccLeft)-2] = app.ui.cmdAccLeft[len(app.ui.cmdAccLeft)-2], app.ui.cmdAccLeft[len(app.ui.cmdAccLeft)-1]
|
app.ui.cmdAccLeft[len(app.ui.cmdAccLeft)-1], app.ui.cmdAccLeft[len(app.ui.cmdAccLeft)-2] = app.ui.cmdAccLeft[len(app.ui.cmdAccLeft)-2], app.ui.cmdAccLeft[len(app.ui.cmdAccLeft)-1]
|
||||||
update(app)
|
update(app)
|
||||||
case "cmd-interrupt":
|
|
||||||
if app.cmd != nil {
|
|
||||||
err := shellKill(app.cmd)
|
|
||||||
if err != nil {
|
|
||||||
app.ui.echoerrf("kill: %s", err)
|
|
||||||
} else {
|
|
||||||
app.ui.echoerr("process interrupt")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
normal(app)
|
|
||||||
case "cmd-word":
|
|
||||||
if len(app.ui.cmdAccRight) == 0 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
loc := reWordEnd.FindStringSubmatchIndex(string(app.ui.cmdAccRight))
|
|
||||||
if loc == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
ind := loc[3]
|
|
||||||
app.ui.cmdAccLeft = append(app.ui.cmdAccLeft, []rune(string(app.ui.cmdAccRight)[:ind])...)
|
|
||||||
app.ui.cmdAccRight = []rune(string(app.ui.cmdAccRight)[ind:])
|
|
||||||
case "cmd-word-back":
|
|
||||||
if len(app.ui.cmdAccLeft) == 0 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
locs := reWordBeg.FindAllStringSubmatchIndex(string(app.ui.cmdAccLeft), -1)
|
|
||||||
if locs == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
ind := locs[len(locs)-1][3]
|
|
||||||
old := app.ui.cmdAccRight
|
|
||||||
app.ui.cmdAccRight = append([]rune(string(app.ui.cmdAccLeft)[ind:]), old...)
|
|
||||||
app.ui.cmdAccLeft = []rune(string(app.ui.cmdAccLeft)[:ind])
|
|
||||||
case "cmd-capitalize-word":
|
|
||||||
if len(app.ui.cmdAccRight) == 0 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
ind := 0
|
|
||||||
for ; ind < len(app.ui.cmdAccRight) && unicode.IsSpace(app.ui.cmdAccRight[ind]); ind++ {
|
|
||||||
}
|
|
||||||
if ind >= len(app.ui.cmdAccRight) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
app.ui.cmdAccRight[ind] = unicode.ToUpper(app.ui.cmdAccRight[ind])
|
|
||||||
loc := reWordEnd.FindStringSubmatchIndex(string(app.ui.cmdAccRight))
|
|
||||||
if loc == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
ind = loc[3]
|
|
||||||
app.ui.cmdAccLeft = append(app.ui.cmdAccLeft, []rune(string(app.ui.cmdAccRight)[:ind])...)
|
|
||||||
app.ui.cmdAccRight = []rune(string(app.ui.cmdAccRight)[ind:])
|
|
||||||
update(app)
|
|
||||||
case "cmd-delete-word":
|
|
||||||
if len(app.ui.cmdAccRight) == 0 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
loc := reWordEnd.FindStringSubmatchIndex(string(app.ui.cmdAccRight))
|
|
||||||
if loc == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
ind := loc[3]
|
|
||||||
app.ui.cmdYankBuf = []rune(string(app.ui.cmdAccRight)[:ind])
|
|
||||||
app.ui.cmdAccRight = []rune(string(app.ui.cmdAccRight)[ind:])
|
|
||||||
update(app)
|
|
||||||
case "cmd-delete-word-back":
|
|
||||||
if len(app.ui.cmdAccLeft) == 0 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
locs := reWordBeg.FindAllStringSubmatchIndex(string(app.ui.cmdAccLeft), -1)
|
|
||||||
if locs == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
ind := locs[len(locs)-1][3]
|
|
||||||
app.ui.cmdYankBuf = []rune(string(app.ui.cmdAccLeft)[ind:])
|
|
||||||
app.ui.cmdAccLeft = []rune(string(app.ui.cmdAccLeft)[:ind])
|
|
||||||
update(app)
|
|
||||||
case "cmd-uppercase-word":
|
|
||||||
if len(app.ui.cmdAccRight) == 0 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
loc := reWordEnd.FindStringSubmatchIndex(string(app.ui.cmdAccRight))
|
|
||||||
if loc == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
ind := loc[3]
|
|
||||||
app.ui.cmdAccLeft = append(app.ui.cmdAccLeft, []rune(strings.ToUpper(string(app.ui.cmdAccRight)[:ind]))...)
|
|
||||||
app.ui.cmdAccRight = []rune(string(app.ui.cmdAccRight)[ind:])
|
|
||||||
update(app)
|
|
||||||
case "cmd-lowercase-word":
|
|
||||||
if len(app.ui.cmdAccRight) == 0 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
loc := reWordEnd.FindStringSubmatchIndex(string(app.ui.cmdAccRight))
|
|
||||||
if loc == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
ind := loc[3]
|
|
||||||
app.ui.cmdAccLeft = append(app.ui.cmdAccLeft, []rune(strings.ToLower(string(app.ui.cmdAccRight)[:ind]))...)
|
|
||||||
app.ui.cmdAccRight = []rune(string(app.ui.cmdAccRight)[ind:])
|
|
||||||
update(app)
|
|
||||||
case "cmd-transpose-word":
|
case "cmd-transpose-word":
|
||||||
if len(app.ui.cmdAccLeft) == 0 {
|
if len(app.ui.cmdAccLeft) == 0 {
|
||||||
return
|
return
|
||||||
@@ -2300,103 +2301,102 @@ func (e *callExpr) eval(app *app, args []string) {
|
|||||||
[]rune(string(app.ui.cmdAccLeft)[end2:]),
|
[]rune(string(app.ui.cmdAccLeft)[end2:]),
|
||||||
)
|
)
|
||||||
update(app)
|
update(app)
|
||||||
case "addcustominfo":
|
case "cmd-word":
|
||||||
var k, v string
|
if len(app.ui.cmdAccRight) == 0 {
|
||||||
switch len(e.args) {
|
|
||||||
case 1:
|
|
||||||
k, v = e.args[0], ""
|
|
||||||
case 2:
|
|
||||||
k, v = e.args[0], e.args[1]
|
|
||||||
default:
|
|
||||||
app.ui.echoerr("addcustominfo: requires either 1 or 2 arguments")
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
loc := reWordEnd.FindStringSubmatchIndex(string(app.ui.cmdAccRight))
|
||||||
path, err := filepath.Abs(replaceTilde(k))
|
if loc == nil {
|
||||||
if err != nil {
|
|
||||||
app.ui.echoerrf("addcustominfo: %s", err)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
ind := loc[3]
|
||||||
dir := filepath.Dir(path)
|
app.ui.cmdAccLeft = append(app.ui.cmdAccLeft, []rune(string(app.ui.cmdAccRight)[:ind])...)
|
||||||
d, ok := app.nav.dirCache[dir]
|
app.ui.cmdAccRight = []rune(string(app.ui.cmdAccRight)[ind:])
|
||||||
if !ok {
|
case "cmd-word-back":
|
||||||
app.ui.echoerrf("addcustominfo: dir not loaded: %s", dir)
|
if len(app.ui.cmdAccLeft) == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
locs := reWordBeg.FindAllStringSubmatchIndex(string(app.ui.cmdAccLeft), -1)
|
||||||
var f *file
|
if locs == nil {
|
||||||
for _, file := range d.allFiles {
|
|
||||||
if file.path == path {
|
|
||||||
f = file
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if f == nil {
|
|
||||||
app.ui.echoerrf("addcustominfo: file not found: %s", path)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
ind := locs[len(locs)-1][3]
|
||||||
if len(strings.Trim(v, " ")) == 0 {
|
old := app.ui.cmdAccRight
|
||||||
v = ""
|
app.ui.cmdAccRight = append([]rune(string(app.ui.cmdAccLeft)[ind:]), old...)
|
||||||
}
|
app.ui.cmdAccLeft = []rune(string(app.ui.cmdAccLeft)[:ind])
|
||||||
if f.customInfo != v {
|
case "cmd-delete-word":
|
||||||
f.customInfo = v
|
if len(app.ui.cmdAccRight) == 0 {
|
||||||
// only sort when order changes
|
|
||||||
if getSortBy(dir) == customSort {
|
|
||||||
d.sort()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case "visual":
|
|
||||||
if !app.nav.init {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
visual(app)
|
loc := reWordEnd.FindStringSubmatchIndex(string(app.ui.cmdAccRight))
|
||||||
case "visual-accept":
|
if loc == nil {
|
||||||
if !app.nav.init {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
dir := app.nav.currDir()
|
ind := loc[3]
|
||||||
for _, path := range dir.visualSelections() {
|
app.ui.cmdYankBuf = []rune(string(app.ui.cmdAccRight)[:ind])
|
||||||
if _, ok := app.nav.selections[path]; !ok {
|
app.ui.cmdAccRight = []rune(string(app.ui.cmdAccRight)[ind:])
|
||||||
app.nav.selections[path] = app.nav.selectionInd
|
update(app)
|
||||||
app.nav.selectionInd++
|
case "cmd-delete-word-back":
|
||||||
}
|
if len(app.ui.cmdAccLeft) == 0 {
|
||||||
}
|
|
||||||
// resetting Visual mode here instead of inside `normal()`
|
|
||||||
// allows us to use Visual mode inside search, find etc.
|
|
||||||
dir.visualAnchor = -1
|
|
||||||
normal(app)
|
|
||||||
case "visual-unselect":
|
|
||||||
if !app.nav.init {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
dir := app.nav.currDir()
|
locs := reWordBeg.FindAllStringSubmatchIndex(string(app.ui.cmdAccLeft), -1)
|
||||||
for _, path := range dir.visualSelections() {
|
if locs == nil {
|
||||||
delete(app.nav.selections, path)
|
|
||||||
}
|
|
||||||
if len(app.nav.selections) == 0 {
|
|
||||||
app.nav.selectionInd = 0
|
|
||||||
}
|
|
||||||
dir.visualAnchor = -1
|
|
||||||
normal(app)
|
|
||||||
case "visual-discard":
|
|
||||||
if !app.nav.init {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
dir := app.nav.currDir()
|
ind := locs[len(locs)-1][3]
|
||||||
dir.visualAnchor = -1
|
app.ui.cmdYankBuf = []rune(string(app.ui.cmdAccLeft)[ind:])
|
||||||
normal(app)
|
app.ui.cmdAccLeft = []rune(string(app.ui.cmdAccLeft)[:ind])
|
||||||
case "visual-change":
|
update(app)
|
||||||
if !app.nav.isVisualMode() {
|
case "cmd-capitalize-word":
|
||||||
|
if len(app.ui.cmdAccRight) == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
dir := app.nav.currDir()
|
ind := 0
|
||||||
beg := max(dir.ind-dir.pos, 0)
|
for ; ind < len(app.ui.cmdAccRight) && unicode.IsSpace(app.ui.cmdAccRight[ind]); ind++ {
|
||||||
dir.ind, dir.visualAnchor = dir.visualAnchor, dir.ind
|
}
|
||||||
dir.pos = dir.ind - beg
|
if ind >= len(app.ui.cmdAccRight) {
|
||||||
dir.visualWrap = -dir.visualWrap
|
return
|
||||||
dir.boundPos(app.nav.height)
|
}
|
||||||
|
app.ui.cmdAccRight[ind] = unicode.ToUpper(app.ui.cmdAccRight[ind])
|
||||||
|
loc := reWordEnd.FindStringSubmatchIndex(string(app.ui.cmdAccRight))
|
||||||
|
if loc == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ind = loc[3]
|
||||||
|
app.ui.cmdAccLeft = append(app.ui.cmdAccLeft, []rune(string(app.ui.cmdAccRight)[:ind])...)
|
||||||
|
app.ui.cmdAccRight = []rune(string(app.ui.cmdAccRight)[ind:])
|
||||||
|
update(app)
|
||||||
|
case "cmd-uppercase-word":
|
||||||
|
if len(app.ui.cmdAccRight) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
loc := reWordEnd.FindStringSubmatchIndex(string(app.ui.cmdAccRight))
|
||||||
|
if loc == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ind := loc[3]
|
||||||
|
app.ui.cmdAccLeft = append(app.ui.cmdAccLeft, []rune(strings.ToUpper(string(app.ui.cmdAccRight)[:ind]))...)
|
||||||
|
app.ui.cmdAccRight = []rune(string(app.ui.cmdAccRight)[ind:])
|
||||||
|
update(app)
|
||||||
|
case "cmd-lowercase-word":
|
||||||
|
if len(app.ui.cmdAccRight) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
loc := reWordEnd.FindStringSubmatchIndex(string(app.ui.cmdAccRight))
|
||||||
|
if loc == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ind := loc[3]
|
||||||
|
app.ui.cmdAccLeft = append(app.ui.cmdAccLeft, []rune(strings.ToLower(string(app.ui.cmdAccRight)[:ind]))...)
|
||||||
|
app.ui.cmdAccRight = []rune(string(app.ui.cmdAccRight)[ind:])
|
||||||
|
update(app)
|
||||||
|
case "on-focus-gained":
|
||||||
|
onFocusGained(app)
|
||||||
|
case "on-focus-lost":
|
||||||
|
onFocusLost(app)
|
||||||
|
case "on-init":
|
||||||
|
onInit(app)
|
||||||
default:
|
default:
|
||||||
cmd, ok := gOpts.cmds[e.name]
|
cmd, ok := gOpts.cmds[e.name]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|||||||
@@ -56,13 +56,10 @@ high (default \(aqH\(aq)
|
|||||||
middle (default \(aqM\(aq)
|
middle (default \(aqM\(aq)
|
||||||
low (default \(aqL\(aq)
|
low (default \(aqL\(aq)
|
||||||
toggle
|
toggle
|
||||||
visual (default \(aqV\(aq)
|
|
||||||
invert (default \(aqv\(aq)
|
invert (default \(aqv\(aq)
|
||||||
unselect (default \(aqu\(aq)
|
unselect (default \(aqu\(aq)
|
||||||
glob\-select
|
glob\-select
|
||||||
glob\-unselect
|
glob\-unselect
|
||||||
calcdirsize
|
|
||||||
clearmaps
|
|
||||||
copy (default \(aqy\(aq)
|
copy (default \(aqy\(aq)
|
||||||
cut (default \(aqd\(aq)
|
cut (default \(aqd\(aq)
|
||||||
paste (default \(aqp\(aq)
|
paste (default \(aqp\(aq)
|
||||||
@@ -72,15 +69,8 @@ draw
|
|||||||
redraw (default \(aq<c\-l>\(aq)
|
redraw (default \(aq<c\-l>\(aq)
|
||||||
load
|
load
|
||||||
reload (default \(aq<c\-r>\(aq)
|
reload (default \(aq<c\-r>\(aq)
|
||||||
echo
|
|
||||||
echomsg
|
|
||||||
echoerr
|
|
||||||
cd
|
|
||||||
select
|
|
||||||
delete (modal)
|
delete (modal)
|
||||||
rename (modal) (default \(aqr\(aq)
|
rename (modal) (default \(aqr\(aq)
|
||||||
source
|
|
||||||
push
|
|
||||||
read (modal) (default \(aq:\(aq)
|
read (modal) (default \(aq:\(aq)
|
||||||
shell (modal) (default \(aq$\(aq)
|
shell (modal) (default \(aq$\(aq)
|
||||||
shell\-pipe (modal) (default \(aq%\(aq)
|
shell\-pipe (modal) (default \(aq%\(aq)
|
||||||
@@ -101,8 +91,18 @@ mark\-load (modal) (default \(dq\(aq\(dq)
|
|||||||
mark\-remove (modal) (default \(aq\(dq\(aq)
|
mark\-remove (modal) (default \(aq\(dq\(aq)
|
||||||
tag
|
tag
|
||||||
tag\-toggle (default \(aqt\(aq)
|
tag\-toggle (default \(aqt\(aq)
|
||||||
|
echo
|
||||||
|
echomsg
|
||||||
|
echoerr
|
||||||
|
cd
|
||||||
|
select
|
||||||
|
source
|
||||||
|
push
|
||||||
addcustominfo
|
addcustominfo
|
||||||
|
calcdirsize
|
||||||
|
clearmaps
|
||||||
tty\-write
|
tty\-write
|
||||||
|
visual (default \(aqV\(aq)
|
||||||
.EE
|
.EE
|
||||||
.PP
|
.PP
|
||||||
The following Visual mode commands are provided by lf:
|
The following Visual mode commands are provided by lf:
|
||||||
@@ -117,6 +117,7 @@ visual\-change (default \(aqo\(aq)
|
|||||||
The following Command\-line mode commands are provided by lf:
|
The following Command\-line mode commands are provided by lf:
|
||||||
.IP
|
.IP
|
||||||
.EX
|
.EX
|
||||||
|
cmd\-insert
|
||||||
cmd\-escape (default \(aq<esc>\(aq)
|
cmd\-escape (default \(aq<esc>\(aq)
|
||||||
cmd\-complete (default \(aq<tab>\(aq)
|
cmd\-complete (default \(aq<tab>\(aq)
|
||||||
cmd\-menu\-complete
|
cmd\-menu\-complete
|
||||||
@@ -436,21 +437,6 @@ A count can be specified to move to a specific line, for example, use
|
|||||||
Move the current file selection to the high/middle/low of the screen.
|
Move the current file selection to the high/middle/low of the screen.
|
||||||
.SS toggle
|
.SS toggle
|
||||||
Toggle the selection of the current file or files given as arguments.
|
Toggle the selection of the current file or files given as arguments.
|
||||||
.SS visual (default \f[CR]V\f[R])
|
|
||||||
Switch to Visual mode.
|
|
||||||
If already in Visual mode, discard the visual selection and stay in
|
|
||||||
Visual mode.
|
|
||||||
.SS visual\-accept (default \f[CR]V\f[R])
|
|
||||||
Add the visual selection to the selection list, quit Visual mode and
|
|
||||||
return to Normal mode.
|
|
||||||
.SS visual\-unselect
|
|
||||||
Remove the visual selection from the selection list, quit Visual mode
|
|
||||||
and return to Normal mode.
|
|
||||||
.SS visual\-discard (default \f[CR]<esc>\f[R])
|
|
||||||
Discard the visual selection, quit Visual mode and return to Normal
|
|
||||||
mode.
|
|
||||||
.SS visual\-change (default \f[CR]o\f[R])
|
|
||||||
Go to the other end of the current Visual mode selection.
|
|
||||||
.SS invert (default \f[CR]v\f[R])
|
.SS invert (default \f[CR]v\f[R])
|
||||||
Reverse the selection of all files in the current directory (i.e.
|
Reverse the selection of all files in the current directory (i.e.
|
||||||
\f[CR]toggle\f[R] all files).
|
\f[CR]toggle\f[R] all files).
|
||||||
@@ -463,20 +449,6 @@ remove selections in other directories.
|
|||||||
Remove the selection of all files in all directories.
|
Remove the selection of all files in all directories.
|
||||||
.SS glob\-select, glob\-unselect
|
.SS glob\-select, glob\-unselect
|
||||||
Select/unselect files that match the given glob.
|
Select/unselect files that match the given glob.
|
||||||
.SS calcdirsize
|
|
||||||
Calculate the total size for each of the selected directories.
|
|
||||||
Option \f[CR]info\f[R] should include \f[CR]size\f[R] and option
|
|
||||||
\f[CR]dircounts\f[R] should be disabled to show this size.
|
|
||||||
If the total size of a directory is not calculated, it will be shown as
|
|
||||||
\f[CR]\-\f[R].
|
|
||||||
.SS clearmaps
|
|
||||||
Remove all keybindings associated with the \f[CR]map\f[R],
|
|
||||||
\f[CR]nmap\f[R] and \f[CR]vmap\f[R] command.
|
|
||||||
This command can be used in the config file to remove the default
|
|
||||||
keybindings.
|
|
||||||
For safety purposes, \f[CR]:\f[R] is left mapped to the \f[CR]read\f[R]
|
|
||||||
command, and \f[CR]cmap\f[R] keybindings are retained so that it is
|
|
||||||
still possible to exit \f[CR]lf\f[R] using \f[CR]:quit\f[R].
|
|
||||||
.SS copy (default \f[CR]y\f[R])
|
.SS copy (default \f[CR]y\f[R])
|
||||||
If there are no selections, save the path of the current file to the
|
If there are no selections, save the path of the current file to the
|
||||||
copy buffer, otherwise, copy the paths of selected files.
|
copy buffer, otherwise, copy the paths of selected files.
|
||||||
@@ -502,18 +474,6 @@ Load modified files and directories.
|
|||||||
This command is automatically called when required.
|
This command is automatically called when required.
|
||||||
.SS reload (default \f[CR]<c\-r>\f[R])
|
.SS reload (default \f[CR]<c\-r>\f[R])
|
||||||
Flush the cache and reload all files and directories.
|
Flush the cache and reload all files and directories.
|
||||||
.SS echo
|
|
||||||
Print the given arguments to the message line at the bottom.
|
|
||||||
.SS echomsg
|
|
||||||
Print the given arguments to the message line at the bottom and also to
|
|
||||||
the log file.
|
|
||||||
.SS echoerr
|
|
||||||
Print given arguments to the message line at the bottom as
|
|
||||||
\f[CR]errorfmt\f[R] and also to the log file.
|
|
||||||
.SS cd
|
|
||||||
Change the working directory to the given argument.
|
|
||||||
.SS select
|
|
||||||
Change the current file selection to the given argument.
|
|
||||||
.SS delete (modal)
|
.SS delete (modal)
|
||||||
Remove the current file or selected file(s).
|
Remove the current file or selected file(s).
|
||||||
A custom \f[CR]delete\f[R] command can be defined to override this
|
A custom \f[CR]delete\f[R] command can be defined to override this
|
||||||
@@ -522,10 +482,6 @@ default.
|
|||||||
Rename the current file using the built\-in method.
|
Rename the current file using the built\-in method.
|
||||||
A custom \f[CR]rename\f[R] command can be defined to override this
|
A custom \f[CR]rename\f[R] command can be defined to override this
|
||||||
default.
|
default.
|
||||||
.SS source
|
|
||||||
Read the configuration file given in the argument.
|
|
||||||
.SS push
|
|
||||||
Simulate key pushes given in the argument.
|
|
||||||
.SS read (modal) (default \f[CR]:\f[R])
|
.SS read (modal) (default \f[CR]:\f[R])
|
||||||
Read a command to evaluate.
|
Read a command to evaluate.
|
||||||
.SS shell (modal) (default \f[CR]$\f[R])
|
.SS shell (modal) (default \f[CR]$\f[R])
|
||||||
@@ -567,12 +523,42 @@ with \f[CR]tag\-toggle\f[R] (i.e.
|
|||||||
.SS tag\-toggle (default \f[CR]t\f[R])
|
.SS tag\-toggle (default \f[CR]t\f[R])
|
||||||
Tag a file with \f[CR]*\f[R] or a single width character given in the
|
Tag a file with \f[CR]*\f[R] or a single width character given in the
|
||||||
argument if the file is untagged, otherwise remove the tag.
|
argument if the file is untagged, otherwise remove the tag.
|
||||||
|
.SS echo
|
||||||
|
Print the given arguments to the message line at the bottom.
|
||||||
|
.SS echomsg
|
||||||
|
Print the given arguments to the message line at the bottom and also to
|
||||||
|
the log file.
|
||||||
|
.SS echoerr
|
||||||
|
Print given arguments to the message line at the bottom as
|
||||||
|
\f[CR]errorfmt\f[R] and also to the log file.
|
||||||
|
.SS cd
|
||||||
|
Change the working directory to the given argument.
|
||||||
|
.SS select
|
||||||
|
Change the current file selection to the given argument.
|
||||||
|
.SS source
|
||||||
|
Read the configuration file given in the argument.
|
||||||
|
.SS push
|
||||||
|
Simulate key pushes given in the argument.
|
||||||
.SS addcustominfo
|
.SS addcustominfo
|
||||||
Update the \f[CR]custom\f[R] info field of the given file with the given
|
Update the \f[CR]custom\f[R] info field of the given file with the given
|
||||||
string.
|
string.
|
||||||
The info string may contain ANSI escape codes to further customize its
|
The info string may contain ANSI escape codes to further customize its
|
||||||
appearance.
|
appearance.
|
||||||
If no info is provided, clear the file\(aqs info instead.
|
If no info is provided, clear the file\(aqs info instead.
|
||||||
|
.SS calcdirsize
|
||||||
|
Calculate the total size for each of the selected directories.
|
||||||
|
Option \f[CR]info\f[R] should include \f[CR]size\f[R] and option
|
||||||
|
\f[CR]dircounts\f[R] should be disabled to show this size.
|
||||||
|
If the total size of a directory is not calculated, it will be shown as
|
||||||
|
\f[CR]\-\f[R].
|
||||||
|
.SS clearmaps
|
||||||
|
Remove all keybindings associated with the \f[CR]map\f[R],
|
||||||
|
\f[CR]nmap\f[R] and \f[CR]vmap\f[R] command.
|
||||||
|
This command can be used in the config file to remove the default
|
||||||
|
keybindings.
|
||||||
|
For safety purposes, \f[CR]:\f[R] is left mapped to the \f[CR]read\f[R]
|
||||||
|
command, and \f[CR]cmap\f[R] keybindings are retained so that it is
|
||||||
|
still possible to exit \f[CR]lf\f[R] using \f[CR]:quit\f[R].
|
||||||
.SS tty\-write
|
.SS tty\-write
|
||||||
Write the given string to the tty.
|
Write the given string to the tty.
|
||||||
This is useful for sending escape sequences to the terminal to control
|
This is useful for sending escape sequences to the terminal to control
|
||||||
@@ -581,7 +567,23 @@ OSC 0 to set the window title).
|
|||||||
Using \f[CR]tty\-write\f[R] is preferred over directly writing to
|
Using \f[CR]tty\-write\f[R] is preferred over directly writing to
|
||||||
\f[CR]/dev/tty\f[R] because the latter is not synchronized and can
|
\f[CR]/dev/tty\f[R] because the latter is not synchronized and can
|
||||||
interfere with drawing the UI.
|
interfere with drawing the UI.
|
||||||
.SH COMMAND LINE COMMANDS
|
.SS visual (default \f[CR]V\f[R])
|
||||||
|
Switch to Visual mode.
|
||||||
|
If already in Visual mode, discard the visual selection and stay in
|
||||||
|
Visual mode.
|
||||||
|
.SH VISUAL MODE COMMANDS
|
||||||
|
.SS visual\-accept (default \f[CR]V\f[R])
|
||||||
|
Add the visual selection to the selection list, quit Visual mode and
|
||||||
|
return to Normal mode.
|
||||||
|
.SS visual\-unselect
|
||||||
|
Remove the visual selection from the selection list, quit Visual mode
|
||||||
|
and return to Normal mode.
|
||||||
|
.SS visual\-discard (default \f[CR]<esc>\f[R])
|
||||||
|
Discard the visual selection, quit Visual mode and return to Normal
|
||||||
|
mode.
|
||||||
|
.SS visual\-change (default \f[CR]o\f[R])
|
||||||
|
Go to the other end of the current Visual mode selection.
|
||||||
|
.SH COMMAND\-LINE MODE COMMANDS
|
||||||
The prompt character specifies which of the several Command\-line modes
|
The prompt character specifies which of the several Command\-line modes
|
||||||
you are in.
|
you are in.
|
||||||
For example, the \f[CR]read\f[R] command takes you to the \f[CR]:\f[R]
|
For example, the \f[CR]read\f[R] command takes you to the \f[CR]:\f[R]
|
||||||
@@ -597,6 +599,9 @@ The command line commands should be mostly compatible with readline
|
|||||||
keybindings.
|
keybindings.
|
||||||
A character refers to a Unicode code point, a word consists of letters
|
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.
|
and digits, and a unix word consists of any non\-blank characters.
|
||||||
|
.SS cmd\-insert
|
||||||
|
Insert the character given in the argument.
|
||||||
|
This command is automatically called when required.
|
||||||
.SS cmd\-escape (default \f[CR]<esc>\f[R])
|
.SS cmd\-escape (default \f[CR]<esc>\f[R])
|
||||||
Quit Command\-line mode and return to Normal mode.
|
Quit Command\-line mode and return to Normal mode.
|
||||||
.SS cmd\-complete (default \f[CR]<tab>\f[R])
|
.SS cmd\-complete (default \f[CR]<tab>\f[R])
|
||||||
|
|||||||
Reference in new issue
Block a user