Skip to content

Commit

Permalink
Make :maps work on Windows and add :cmaps. (#1201)
Browse files Browse the repository at this point in the history
* Make `:maps` work on Windows

This makes the `:maps` command from #1146 work on Windows.

This (as well as `:maps` itself) is based on @jackielli's work in #1146 and
#1152.

I intend to refactor the code in this or a separate PR, but I thought I'd
submit the critical and simple bit first.

* Add `:cmaps` command

After the naming scheme from #1146, it would seem weird to not have a :cmaps
command. This could help with issues like #876.
  • Loading branch information
ilyagr authored Apr 8, 2023
1 parent bb45d15 commit 1e1486f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions complete.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ var (
"map",
"maps",
"cmap",
"cmaps",
"cmd",
"quit",
"up",
Expand Down
4 changes: 3 additions & 1 deletion doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ The following commands are provided by lf:
tag
tag-toggle (default 't')
maps
cmaps
The following command line commands are provided by lf:
Expand Down Expand Up @@ -605,8 +606,9 @@ Delete the next word in forward direction.
Capitalize/uppercase/lowercase the current word and jump to the next word.
maps
cmaps
List all key mappings.
List all key mappings in normal mode or command-line editing mode.
# Options
Expand Down
4 changes: 3 additions & 1 deletion docstring.go

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

7 changes: 6 additions & 1 deletion eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -2479,10 +2479,15 @@ func (e *callExpr) eval(app *app, args []string) {
app.ui.cmdAccLeft = acc
update(app)
case "maps":
cleanUp := app.runShell("$PAGER", nil, "$|")
cleanUp := app.runShell(envPager, nil, "$|")
io.Copy(app.cmdIn, listBinds(gOpts.keys))
app.cmdIn.Close()
cleanUp()
case "cmaps":
cleanUp := app.runShell(envPager, nil, "$|")
io.Copy(app.cmdIn, listBinds(gOpts.cmdkeys))
app.cmdIn.Close()
cleanUp()
default:
cmd, ok := gOpts.cmds[e.name]
if !ok {
Expand Down
4 changes: 3 additions & 1 deletion lf.1
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ The following commands are provided by lf:
tag
tag-toggle (default 't')
maps
cmaps
.EE
.PP
The following command line commands are provided by lf:
Expand Down Expand Up @@ -746,9 +747,10 @@ Capitalize/uppercase/lowercase the current word and jump to the next word.
.PP
.EX
maps
cmaps
.EE
.PP
List all key mappings.
List all key mappings in normal mode or command-line editing mode.
.SH OPTIONS
This section shows information about options to customize the behavior. Character ':' is used as the separator for list options '[]int' and '[]string'.
.PP
Expand Down

0 comments on commit 1e1486f

Please sign in to comment.