Skip to content

Commit

Permalink
Add clearmaps command (gokcehan#1286)
Browse files Browse the repository at this point in the history
  • Loading branch information
joelim-work authored Jun 4, 2023
1 parent c874a2c commit 2c13e0d
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions complete.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ var (
"glob-select",
"glob-unselect",
"calcdirsize",
"clearmaps",
"copy",
"cut",
"paste",
Expand Down
7 changes: 7 additions & 0 deletions doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ The following commands are provided by lf:
glob-select
glob-unselect
calcdirsize
clearmaps
copy (default 'y')
cut (default 'd')
paste (default 'p')
Expand Down Expand Up @@ -382,6 +383,12 @@ 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` 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')
If there are no selections, save the path of the current file to the copy buffer, otherwise, copy the paths of selected files.
Expand Down
8 changes: 8 additions & 0 deletions docstring.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -1614,6 +1614,10 @@ func (e *callExpr) eval(app *app, args []string) {
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`
gOpts.keys = make(map[string]expr)
gOpts.keys[":"] = &callExpr{"read", nil, 1}
case "copy":
if !app.nav.init {
return
Expand Down
7 changes: 7 additions & 0 deletions lf.1
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ The following commands are provided by lf:
glob-select
glob-unselect
calcdirsize
clearmaps
copy (default 'y')
cut (default 'd')
paste (default 'p')
Expand Down Expand Up @@ -444,6 +445,12 @@ Select/unselect files that match the given glob.
.PP
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 '-'.
.PP
.EX
clearmaps
.EE
.PP
Remove all keybindings associated with the `map` 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`.
.PP
.EX
copy (default 'y')
.EE
Expand Down

0 comments on commit 2c13e0d

Please sign in to comment.