Add option to hide listBinds when pressing keys (#1815)

* add drawbinds option

* rename drawbinds to showbinds and change its place in docs

* minor changes in wording of showbinds option

* fix missing newlines

---------

Co-authored-by: yarik <dazzywi@github.com>
This commit is contained in:
yarikandyarik authored and GitHub committed 2024-10-22 23:45:48 +11:00
1 parent 440c258287
commit 6cd51210e3
6 files changed
+24 -4

No files matched your search

+6 -1
View File
@@ -188,6 +188,7 @@ The following options can be used to customize the behavior of lf:
shell string (default 'sh' for Unix and 'cmd' for Windows)
shellflag string (default '-c' for Unix and '/c' for Windows)
shellopts []string (default '')
showbinds bool (default true)
sixel bool (default false)
smartcase bool (default true)
smartdia bool (default false)
@@ -928,6 +929,10 @@ Command line flag used to pass shell commands.
List of shell options to pass to the shell executable.
## showbinds (bool) (default true)
Show bindings associated with pressed keys.
## sixel (bool) (default false)
Render sixel images in preview.
@@ -1834,4 +1839,4 @@ A sample icons file can be found at
https://github.com/gokcehan/lf/blob/master/etc/icons.example
A sample colored icons file can be found at
https://github.com/gokcehan/lf/blob/master/etc/icons_colored.example
https://github.com/gokcehan/lf/blob/master/etc/icons_colored.example
+6 -1
View File
@@ -178,6 +178,7 @@ The following options can be used to customize the behavior of lf:
shell string (default 'sh' for Unix and 'cmd' for Windows)
shellflag string (default '-c' for Unix and '/c' for Windows)
shellopts []string (default '')
showbinds bool (default true)
sixel bool (default false)
smartcase bool (default true)
smartdia bool (default false)
@@ -1010,6 +1011,10 @@ shellopts ([]string) (default ``)
List of shell options to pass to the shell executable.
showbinds (bool) (default true)
Show bindings associated with pressed keys.
sixel (bool) (default false)
Render sixel images in preview.
@@ -2078,4 +2083,4 @@ A sample icons file can be found at
https://github.com/gokcehan/lf/blob/master/etc/icons.example
A sample colored icons file can be found at
https://github.com/gokcehan/lf/blob/master/etc/icons_colored.example
https://github.com/gokcehan/lf/blob/master/etc/icons_colored.example
+2
View File
@@ -169,6 +169,8 @@ func (e *setExpr) eval(app *app, args []string) {
}
case "roundbox", "noroundbox", "roundbox!":
err = applyBoolOpt(&gOpts.roundbox, e)
case "showbinds", "noshowbinds", "showbinds!":
err = applyBoolOpt(&gOpts.showbinds, e)
case "sixel", "nosixel", "sixel!":
err = applyBoolOpt(&gOpts.sixel, e)
case "smartcase", "nosmartcase", "smartcase!":
+5 -1
View File
@@ -196,6 +196,7 @@ selmode string (default \[aq]all\[aq])
shell string (default \[aq]sh\[aq] for Unix and \[aq]cmd\[aq] for Windows)
shellflag string (default \[aq]-c\[aq] for Unix and \[aq]/c\[aq] for Windows)
shellopts []string (default \[aq]\[aq])
showbinds bool (default true)
sixel bool (default false)
smartcase bool (default true)
smartdia bool (default false)
@@ -1027,6 +1028,9 @@ Command line flag used to pass shell commands.
.SS shellopts ([]string) (default \[ga]\[ga])
.PP
List of shell options to pass to the shell executable.
.SS showbinds (bool) (default true)
.PP
Show bindings associated with pressed keys.
.SS sixel (bool) (default false)
.PP
Render sixel images in preview.
@@ -2419,4 +2423,4 @@ A sample icons file can be found at
<https://github.com/gokcehan/lf/blob/master/etc/icons.example>
.PP
A sample colored icons file can be found at
<https://github.com/gokcehan/lf/blob/master/etc/icons_colored.example>
<https://github.com/gokcehan/lf/blob/master/etc/icons_colored.example>
+2
View File
@@ -60,6 +60,7 @@ var gOpts struct {
reverse bool
roundbox bool
selectfmt string
showbinds bool
sixel bool
sortby sortMethod
smartcase bool
@@ -206,6 +207,7 @@ func init() {
gOpts.reverse = false
gOpts.roundbox = false
gOpts.selectfmt = "\033[7;35m"
gOpts.showbinds = true
gOpts.sixel = false
gOpts.sortby = naturalSort
gOpts.smartcase = true
+3 -1
View File
@@ -1359,7 +1359,9 @@ func (ui *ui) readNormalEvent(ev tcell.Event, nav *nav) expr {
ui.menuBuf = nil
return expr
}
ui.menuBuf = listBinds(binds)
if gOpts.showbinds {
ui.menuBuf = listBinds(binds)
}
return draw
}
case *tcell.EventMouse: