Replace hidecursorinactive with hook commands (#1763)
* Replace `hidecursorinactive` with hook commands * Remove `focusreport` setting
This commit is contained in:
1 parent
67038762cc
commit
e9faf966a0
6 files changed
+346
-310
No files matched your search
@@ -136,76 +136,75 @@ The following command line commands are provided by lf:
|
|||||||
|
|
||||||
The following options can be used to customize the behavior of lf:
|
The following options can be used to customize the behavior of lf:
|
||||||
|
|
||||||
anchorfind bool (default true)
|
anchorfind bool (default true)
|
||||||
autoquit bool (default false)
|
autoquit bool (default false)
|
||||||
borderfmt string (default "\033[0m")
|
borderfmt string (default "\033[0m")
|
||||||
cleaner string (default '')
|
cleaner string (default '')
|
||||||
copyfmt string (default "\033[7;33m")
|
copyfmt string (default "\033[7;33m")
|
||||||
cursoractivefmt string (default "\033[7m")
|
cursoractivefmt string (default "\033[7m")
|
||||||
cursorparentfmt string (default "\033[7m")
|
cursorparentfmt string (default "\033[7m")
|
||||||
cursorpreviewfmt string (default "\033[4m")
|
cursorpreviewfmt string (default "\033[4m")
|
||||||
cutfmt string (default "\033[7;31m")
|
cutfmt string (default "\033[7;31m")
|
||||||
dircache bool (default true)
|
dircache bool (default true)
|
||||||
dircounts bool (default false)
|
dircounts bool (default false)
|
||||||
dirfirst bool (default true)
|
dirfirst bool (default true)
|
||||||
dironly bool (default false)
|
dironly bool (default false)
|
||||||
dirpreviews bool (default false)
|
dirpreviews bool (default false)
|
||||||
drawbox bool (default false)
|
drawbox bool (default false)
|
||||||
dupfilefmt string (default '%f.~%n~')
|
dupfilefmt string (default '%f.~%n~')
|
||||||
errorfmt string (default "\033[7;31;47m")
|
errorfmt string (default "\033[7;31;47m")
|
||||||
filesep string (default "\n")
|
filesep string (default "\n")
|
||||||
findlen int (default 1)
|
findlen int (default 1)
|
||||||
globfilter bool (default false)
|
globfilter bool (default false)
|
||||||
globsearch bool (default false)
|
globsearch bool (default false)
|
||||||
hidden bool (default false)
|
hidden bool (default false)
|
||||||
hiddenfiles []string (default '.*' for Unix and '' for Windows)
|
hiddenfiles []string (default '.*' for Unix and '' for Windows)
|
||||||
hidecursorinactive bool (default false)
|
history bool (default true)
|
||||||
history bool (default true)
|
icons bool (default false)
|
||||||
icons bool (default false)
|
ifs string (default '')
|
||||||
ifs string (default '')
|
ignorecase bool (default true)
|
||||||
ignorecase bool (default true)
|
ignoredia bool (default true)
|
||||||
ignoredia bool (default true)
|
incfilter bool (default false)
|
||||||
incfilter bool (default false)
|
incsearch bool (default false)
|
||||||
incsearch bool (default false)
|
info []string (default '')
|
||||||
info []string (default '')
|
infotimefmtnew string (default 'Jan _2 15:04')
|
||||||
infotimefmtnew string (default 'Jan _2 15:04')
|
infotimefmtold string (default 'Jan _2 2006')
|
||||||
infotimefmtold string (default 'Jan _2 2006')
|
mouse bool (default false)
|
||||||
mouse bool (default false)
|
number bool (default false)
|
||||||
number bool (default false)
|
numberfmt string (default "\033[33m")
|
||||||
numberfmt string (default "\033[33m")
|
period int (default 0)
|
||||||
period int (default 0)
|
preserve []string (default "mode")
|
||||||
preserve []string (default "mode")
|
preview bool (default true)
|
||||||
preview bool (default true)
|
previewer string (default '')
|
||||||
previewer string (default '')
|
promptfmt string (default "\033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f\033[0m")
|
||||||
promptfmt string (default "\033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f\033[0m")
|
ratios []int (default '1:2:3')
|
||||||
ratios []int (default '1:2:3')
|
relativenumber bool (default false)
|
||||||
relativenumber bool (default false)
|
reverse bool (default false)
|
||||||
reverse bool (default false)
|
roundbox bool (default false)
|
||||||
roundbox bool (default false)
|
ruler []string (default 'acc:progress:selection:filter:ind')
|
||||||
ruler []string (default 'acc:progress:selection:filter:ind')
|
rulerfmt string (default " %a| %p| \033[7;31m %m \033[0m| \033[7;33m %c \033[0m| \033[7;35m %s \033[0m| \033[7;34m %f \033[0m| %i/%t")
|
||||||
rulerfmt string (default " %a| %p| \033[7;31m %m \033[0m| \033[7;33m %c \033[0m| \033[7;35m %s \033[0m| \033[7;34m %f \033[0m| %i/%t")
|
scrolloff int (default 0)
|
||||||
scrolloff int (default 0)
|
selectfmt string (default "\033[7;35m")
|
||||||
selectfmt string (default "\033[7;35m")
|
selmode string (default 'all')
|
||||||
selmode string (default 'all')
|
shell string (default 'sh' for Unix and 'cmd' for Windows)
|
||||||
shell string (default 'sh' for Unix and 'cmd' for Windows)
|
shellflag string (default '-c' for Unix and '/c' for Windows)
|
||||||
shellflag string (default '-c' for Unix and '/c' for Windows)
|
shellopts []string (default '')
|
||||||
shellopts []string (default '')
|
sixel bool (default false)
|
||||||
sixel bool (default false)
|
smartcase bool (default true)
|
||||||
smartcase bool (default true)
|
smartdia bool (default false)
|
||||||
smartdia bool (default false)
|
sortby string (default 'natural')
|
||||||
sortby string (default 'natural')
|
statfmt string (default "\033[36m%p\033[0m| %c| %u| %g| %S| %t| -> %l")
|
||||||
statfmt string (default "\033[36m%p\033[0m| %c| %u| %g| %S| %t| -> %l")
|
tabstop int (default 8)
|
||||||
tabstop int (default 8)
|
tagfmt string (default "\033[31m")
|
||||||
tagfmt string (default "\033[31m")
|
tempmarks string (default '')
|
||||||
tempmarks string (default '')
|
timefmt string (default 'Mon Jan _2 15:04:05 2006')
|
||||||
timefmt string (default 'Mon Jan _2 15:04:05 2006')
|
truncatechar string (default '~')
|
||||||
truncatechar string (default '~')
|
truncatepct int (default 100)
|
||||||
truncatepct int (default 100)
|
waitmsg string (default 'Press any key to continue')
|
||||||
waitmsg string (default 'Press any key to continue')
|
watch bool (default false)
|
||||||
watch bool (default false)
|
wrapscan bool (default true)
|
||||||
wrapscan bool (default true)
|
wrapscroll bool (default false)
|
||||||
wrapscroll bool (default false)
|
user_{option} string (default none)
|
||||||
user_{option} string (default none)
|
|
||||||
|
|
||||||
The following environment variables are exported for shell commands:
|
The following environment variables are exported for shell commands:
|
||||||
|
|
||||||
@@ -237,6 +236,8 @@ The following special shell commands are used to customize the behavior of lf wh
|
|||||||
delete
|
delete
|
||||||
pre-cd
|
pre-cd
|
||||||
on-cd
|
on-cd
|
||||||
|
on-focus-gained
|
||||||
|
on-focus-lost
|
||||||
on-select
|
on-select
|
||||||
on-redraw
|
on-redraw
|
||||||
on-quit
|
on-quit
|
||||||
@@ -775,10 +776,6 @@ Patterns can be given as relative or absolute paths.
|
|||||||
Globbing supports the usual special characters, `*` to match any sequence, `?` to match any character, and `[...]` or `[^...]` to match character sets or ranges.
|
Globbing supports the usual special characters, `*` to match any sequence, `?` to match any character, and `[...]` or `[^...]` to match character sets or ranges.
|
||||||
In addition, if a pattern starts with `!`, then its matches are excluded from hidden files. To add multiple patterns, use `:` as a separator. Example: `.*:lost+found:*.bak`
|
In addition, if a pattern starts with `!`, then its matches are excluded from hidden files. To add multiple patterns, use `:` as a separator. Example: `.*:lost+found:*.bak`
|
||||||
|
|
||||||
## hidecursorinactive (bool) (default false)
|
|
||||||
|
|
||||||
Hide the cursor when the terminal or tmux pane loses focus.
|
|
||||||
|
|
||||||
## history (bool) (default true)
|
## history (bool) (default true)
|
||||||
|
|
||||||
Save command history.
|
Save command history.
|
||||||
@@ -1141,6 +1138,14 @@ This shell command can be defined to be executed before changing a directory.
|
|||||||
|
|
||||||
This shell command can be defined to be executed after changing a directory.
|
This shell command can be defined to be executed after changing a directory.
|
||||||
|
|
||||||
|
## on-focus-gained
|
||||||
|
|
||||||
|
This shell command can be defined to be executed when the terminal gains focus.
|
||||||
|
|
||||||
|
## on-focus-lost
|
||||||
|
|
||||||
|
This shell command can be defined to be executed when the terminal loses focus.
|
||||||
|
|
||||||
## on-select
|
## on-select
|
||||||
|
|
||||||
This shell command can be defined to be executed after the selection changes.
|
This shell command can be defined to be executed after the selection changes.
|
||||||
|
|||||||
@@ -126,76 +126,75 @@ The following command line commands are provided by lf:
|
|||||||
|
|
||||||
The following options can be used to customize the behavior of lf:
|
The following options can be used to customize the behavior of lf:
|
||||||
|
|
||||||
anchorfind bool (default true)
|
anchorfind bool (default true)
|
||||||
autoquit bool (default false)
|
autoquit bool (default false)
|
||||||
borderfmt string (default "\033[0m")
|
borderfmt string (default "\033[0m")
|
||||||
cleaner string (default '')
|
cleaner string (default '')
|
||||||
copyfmt string (default "\033[7;33m")
|
copyfmt string (default "\033[7;33m")
|
||||||
cursoractivefmt string (default "\033[7m")
|
cursoractivefmt string (default "\033[7m")
|
||||||
cursorparentfmt string (default "\033[7m")
|
cursorparentfmt string (default "\033[7m")
|
||||||
cursorpreviewfmt string (default "\033[4m")
|
cursorpreviewfmt string (default "\033[4m")
|
||||||
cutfmt string (default "\033[7;31m")
|
cutfmt string (default "\033[7;31m")
|
||||||
dircache bool (default true)
|
dircache bool (default true)
|
||||||
dircounts bool (default false)
|
dircounts bool (default false)
|
||||||
dirfirst bool (default true)
|
dirfirst bool (default true)
|
||||||
dironly bool (default false)
|
dironly bool (default false)
|
||||||
dirpreviews bool (default false)
|
dirpreviews bool (default false)
|
||||||
drawbox bool (default false)
|
drawbox bool (default false)
|
||||||
dupfilefmt string (default '%f.~%n~')
|
dupfilefmt string (default '%f.~%n~')
|
||||||
errorfmt string (default "\033[7;31;47m")
|
errorfmt string (default "\033[7;31;47m")
|
||||||
filesep string (default "\n")
|
filesep string (default "\n")
|
||||||
findlen int (default 1)
|
findlen int (default 1)
|
||||||
globfilter bool (default false)
|
globfilter bool (default false)
|
||||||
globsearch bool (default false)
|
globsearch bool (default false)
|
||||||
hidden bool (default false)
|
hidden bool (default false)
|
||||||
hiddenfiles []string (default '.*' for Unix and '' for Windows)
|
hiddenfiles []string (default '.*' for Unix and '' for Windows)
|
||||||
hidecursorinactive bool (default false)
|
history bool (default true)
|
||||||
history bool (default true)
|
icons bool (default false)
|
||||||
icons bool (default false)
|
ifs string (default '')
|
||||||
ifs string (default '')
|
ignorecase bool (default true)
|
||||||
ignorecase bool (default true)
|
ignoredia bool (default true)
|
||||||
ignoredia bool (default true)
|
incfilter bool (default false)
|
||||||
incfilter bool (default false)
|
incsearch bool (default false)
|
||||||
incsearch bool (default false)
|
info []string (default '')
|
||||||
info []string (default '')
|
infotimefmtnew string (default 'Jan _2 15:04')
|
||||||
infotimefmtnew string (default 'Jan _2 15:04')
|
infotimefmtold string (default 'Jan _2 2006')
|
||||||
infotimefmtold string (default 'Jan _2 2006')
|
mouse bool (default false)
|
||||||
mouse bool (default false)
|
number bool (default false)
|
||||||
number bool (default false)
|
numberfmt string (default "\033[33m")
|
||||||
numberfmt string (default "\033[33m")
|
period int (default 0)
|
||||||
period int (default 0)
|
preserve []string (default "mode")
|
||||||
preserve []string (default "mode")
|
preview bool (default true)
|
||||||
preview bool (default true)
|
previewer string (default '')
|
||||||
previewer string (default '')
|
promptfmt string (default "\033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f\033[0m")
|
||||||
promptfmt string (default "\033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f\033[0m")
|
ratios []int (default '1:2:3')
|
||||||
ratios []int (default '1:2:3')
|
relativenumber bool (default false)
|
||||||
relativenumber bool (default false)
|
reverse bool (default false)
|
||||||
reverse bool (default false)
|
roundbox bool (default false)
|
||||||
roundbox bool (default false)
|
ruler []string (default 'acc:progress:selection:filter:ind')
|
||||||
ruler []string (default 'acc:progress:selection:filter:ind')
|
rulerfmt string (default " %a| %p| \033[7;31m %m \033[0m| \033[7;33m %c \033[0m| \033[7;35m %s \033[0m| \033[7;34m %f \033[0m| %i/%t")
|
||||||
rulerfmt string (default " %a| %p| \033[7;31m %m \033[0m| \033[7;33m %c \033[0m| \033[7;35m %s \033[0m| \033[7;34m %f \033[0m| %i/%t")
|
scrolloff int (default 0)
|
||||||
scrolloff int (default 0)
|
selectfmt string (default "\033[7;35m")
|
||||||
selectfmt string (default "\033[7;35m")
|
selmode string (default 'all')
|
||||||
selmode string (default 'all')
|
shell string (default 'sh' for Unix and 'cmd' for Windows)
|
||||||
shell string (default 'sh' for Unix and 'cmd' for Windows)
|
shellflag string (default '-c' for Unix and '/c' for Windows)
|
||||||
shellflag string (default '-c' for Unix and '/c' for Windows)
|
shellopts []string (default '')
|
||||||
shellopts []string (default '')
|
sixel bool (default false)
|
||||||
sixel bool (default false)
|
smartcase bool (default true)
|
||||||
smartcase bool (default true)
|
smartdia bool (default false)
|
||||||
smartdia bool (default false)
|
sortby string (default 'natural')
|
||||||
sortby string (default 'natural')
|
statfmt string (default "\033[36m%p\033[0m| %c| %u| %g| %S| %t| -> %l")
|
||||||
statfmt string (default "\033[36m%p\033[0m| %c| %u| %g| %S| %t| -> %l")
|
tabstop int (default 8)
|
||||||
tabstop int (default 8)
|
tagfmt string (default "\033[31m")
|
||||||
tagfmt string (default "\033[31m")
|
tempmarks string (default '')
|
||||||
tempmarks string (default '')
|
timefmt string (default 'Mon Jan _2 15:04:05 2006')
|
||||||
timefmt string (default 'Mon Jan _2 15:04:05 2006')
|
truncatechar string (default '~')
|
||||||
truncatechar string (default '~')
|
truncatepct int (default 100)
|
||||||
truncatepct int (default 100)
|
waitmsg string (default 'Press any key to continue')
|
||||||
waitmsg string (default 'Press any key to continue')
|
watch bool (default false)
|
||||||
watch bool (default false)
|
wrapscan bool (default true)
|
||||||
wrapscan bool (default true)
|
wrapscroll bool (default false)
|
||||||
wrapscroll bool (default false)
|
user_{option} string (default none)
|
||||||
user_{option} string (default none)
|
|
||||||
|
|
||||||
The following environment variables are exported for shell commands:
|
The following environment variables are exported for shell commands:
|
||||||
|
|
||||||
@@ -228,6 +227,8 @@ of lf when defined:
|
|||||||
delete
|
delete
|
||||||
pre-cd
|
pre-cd
|
||||||
on-cd
|
on-cd
|
||||||
|
on-focus-gained
|
||||||
|
on-focus-lost
|
||||||
on-select
|
on-select
|
||||||
on-redraw
|
on-redraw
|
||||||
on-quit
|
on-quit
|
||||||
@@ -827,10 +828,6 @@ match character sets or ranges. In addition, if a pattern starts with !,
|
|||||||
then its matches are excluded from hidden files. To add multiple
|
then its matches are excluded from hidden files. To add multiple
|
||||||
patterns, use : as a separator. Example: .*:lost+found:*.bak
|
patterns, use : as a separator. Example: .*:lost+found:*.bak
|
||||||
|
|
||||||
hidecursorinactive (bool) (default false)
|
|
||||||
|
|
||||||
Hide the cursor when the terminal or tmux pane loses focus.
|
|
||||||
|
|
||||||
history (bool) (default true)
|
history (bool) (default true)
|
||||||
|
|
||||||
Save command history.
|
Save command history.
|
||||||
@@ -1260,6 +1257,16 @@ on-cd
|
|||||||
This shell command can be defined to be executed after changing a
|
This shell command can be defined to be executed after changing a
|
||||||
directory.
|
directory.
|
||||||
|
|
||||||
|
on-focus-gained
|
||||||
|
|
||||||
|
This shell command can be defined to be executed when the terminal gains
|
||||||
|
focus.
|
||||||
|
|
||||||
|
on-focus-lost
|
||||||
|
|
||||||
|
This shell command can be defined to be executed when the terminal loses
|
||||||
|
focus.
|
||||||
|
|
||||||
on-select
|
on-select
|
||||||
|
|
||||||
This shell command can be defined to be executed after the selection
|
This shell command can be defined to be executed after the selection
|
||||||
|
|||||||
@@ -114,15 +114,6 @@ func (e *setExpr) eval(app *app, args []string) {
|
|||||||
app.ui.sort()
|
app.ui.sort()
|
||||||
app.ui.loadFile(app, true)
|
app.ui.loadFile(app, true)
|
||||||
}
|
}
|
||||||
case "hidecursorinactive", "nohidecursorinactive", "hidecursorinactive!":
|
|
||||||
err = applyBoolOpt(&gOpts.hidecursorinactive, e)
|
|
||||||
if err == nil {
|
|
||||||
if gOpts.hidecursorinactive {
|
|
||||||
app.ui.screen.EnableFocus()
|
|
||||||
} else {
|
|
||||||
app.ui.screen.DisableFocus()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case "history", "nohistory", "history!":
|
case "history", "nohistory", "history!":
|
||||||
err = applyBoolOpt(&gOpts.history, e)
|
err = applyBoolOpt(&gOpts.history, e)
|
||||||
case "icons", "noicons", "icons!":
|
case "icons", "noicons", "icons!":
|
||||||
@@ -562,6 +553,18 @@ func (e *cmdExpr) eval(app *app, args []string) {
|
|||||||
} else {
|
} else {
|
||||||
gOpts.cmds[e.name] = e.expr
|
gOpts.cmds[e.name] = e.expr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// only enable focus reporting if required by the user
|
||||||
|
if e.name == "on-focus-gained" || e.name == "on-focus-lost" {
|
||||||
|
_, onFocusGainedExists := gOpts.cmds["on-focus-gained"]
|
||||||
|
_, onFocusLostExists := gOpts.cmds["on-focus-lost"]
|
||||||
|
if onFocusGainedExists || onFocusLostExists {
|
||||||
|
app.ui.screen.EnableFocus()
|
||||||
|
} else {
|
||||||
|
app.ui.screen.DisableFocus()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
app.ui.loadFileInfo(app.nav)
|
app.ui.loadFileInfo(app.nav)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -579,6 +582,18 @@ func onChdir(app *app) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func onFocusGained(app *app) {
|
||||||
|
if cmd, ok := gOpts.cmds["on-focus-gained"]; ok {
|
||||||
|
cmd.eval(app, nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func onFocusLost(app *app) {
|
||||||
|
if cmd, ok := gOpts.cmds["on-focus-lost"]; ok {
|
||||||
|
cmd.eval(app, nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func onRedraw(app *app) {
|
func onRedraw(app *app) {
|
||||||
if cmd, ok := gOpts.cmds["on-redraw"]; ok {
|
if cmd, ok := gOpts.cmds["on-redraw"]; ok {
|
||||||
cmd.eval(app, nil)
|
cmd.eval(app, nil)
|
||||||
@@ -1774,6 +1789,10 @@ 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":
|
||||||
|
onFocusGained(app)
|
||||||
|
case "on-focus-lost":
|
||||||
|
onFocusLost(app)
|
||||||
case "cmd-insert":
|
case "cmd-insert":
|
||||||
if len(e.args) == 0 {
|
if len(e.args) == 0 {
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
.\" Automatically generated by Pandoc 2.11.4
|
.\" Automatically generated by Pandoc 2.11.4
|
||||||
.\"
|
.\"
|
||||||
.TH "LF" "1" "2024-06-22" "" "DOCUMENTATION"
|
.TH "LF" "1" "2024-06-30" "" "DOCUMENTATION"
|
||||||
.hy
|
.hy
|
||||||
.SH NAME
|
.SH NAME
|
||||||
.PP
|
.PP
|
||||||
@@ -144,76 +144,75 @@ The following options can be used to customize the behavior of lf:
|
|||||||
.IP
|
.IP
|
||||||
.nf
|
.nf
|
||||||
\f[C]
|
\f[C]
|
||||||
anchorfind bool (default true)
|
anchorfind bool (default true)
|
||||||
autoquit bool (default false)
|
autoquit bool (default false)
|
||||||
borderfmt string (default \[dq]\[rs]033[0m\[dq])
|
borderfmt string (default \[dq]\[rs]033[0m\[dq])
|
||||||
cleaner string (default \[aq]\[aq])
|
cleaner string (default \[aq]\[aq])
|
||||||
copyfmt string (default \[dq]\[rs]033[7;33m\[dq])
|
copyfmt string (default \[dq]\[rs]033[7;33m\[dq])
|
||||||
cursoractivefmt string (default \[dq]\[rs]033[7m\[dq])
|
cursoractivefmt string (default \[dq]\[rs]033[7m\[dq])
|
||||||
cursorparentfmt string (default \[dq]\[rs]033[7m\[dq])
|
cursorparentfmt string (default \[dq]\[rs]033[7m\[dq])
|
||||||
cursorpreviewfmt string (default \[dq]\[rs]033[4m\[dq])
|
cursorpreviewfmt string (default \[dq]\[rs]033[4m\[dq])
|
||||||
cutfmt string (default \[dq]\[rs]033[7;31m\[dq])
|
cutfmt string (default \[dq]\[rs]033[7;31m\[dq])
|
||||||
dircache bool (default true)
|
dircache bool (default true)
|
||||||
dircounts bool (default false)
|
dircounts bool (default false)
|
||||||
dirfirst bool (default true)
|
dirfirst bool (default true)
|
||||||
dironly bool (default false)
|
dironly bool (default false)
|
||||||
dirpreviews bool (default false)
|
dirpreviews bool (default false)
|
||||||
drawbox bool (default false)
|
drawbox bool (default false)
|
||||||
dupfilefmt string (default \[aq]%f.\[ti]%n\[ti]\[aq])
|
dupfilefmt string (default \[aq]%f.\[ti]%n\[ti]\[aq])
|
||||||
errorfmt string (default \[dq]\[rs]033[7;31;47m\[dq])
|
errorfmt string (default \[dq]\[rs]033[7;31;47m\[dq])
|
||||||
filesep string (default \[dq]\[rs]n\[dq])
|
filesep string (default \[dq]\[rs]n\[dq])
|
||||||
findlen int (default 1)
|
findlen int (default 1)
|
||||||
globfilter bool (default false)
|
globfilter bool (default false)
|
||||||
globsearch bool (default false)
|
globsearch bool (default false)
|
||||||
hidden bool (default false)
|
hidden bool (default false)
|
||||||
hiddenfiles []string (default \[aq].*\[aq] for Unix and \[aq]\[aq] for Windows)
|
hiddenfiles []string (default \[aq].*\[aq] for Unix and \[aq]\[aq] for Windows)
|
||||||
hidecursorinactive bool (default false)
|
history bool (default true)
|
||||||
history bool (default true)
|
icons bool (default false)
|
||||||
icons bool (default false)
|
ifs string (default \[aq]\[aq])
|
||||||
ifs string (default \[aq]\[aq])
|
ignorecase bool (default true)
|
||||||
ignorecase bool (default true)
|
ignoredia bool (default true)
|
||||||
ignoredia bool (default true)
|
incfilter bool (default false)
|
||||||
incfilter bool (default false)
|
incsearch bool (default false)
|
||||||
incsearch bool (default false)
|
info []string (default \[aq]\[aq])
|
||||||
info []string (default \[aq]\[aq])
|
infotimefmtnew string (default \[aq]Jan _2 15:04\[aq])
|
||||||
infotimefmtnew string (default \[aq]Jan _2 15:04\[aq])
|
infotimefmtold string (default \[aq]Jan _2 2006\[aq])
|
||||||
infotimefmtold string (default \[aq]Jan _2 2006\[aq])
|
mouse bool (default false)
|
||||||
mouse bool (default false)
|
number bool (default false)
|
||||||
number bool (default false)
|
numberfmt string (default \[dq]\[rs]033[33m\[dq])
|
||||||
numberfmt string (default \[dq]\[rs]033[33m\[dq])
|
period int (default 0)
|
||||||
period int (default 0)
|
preserve []string (default \[dq]mode\[dq])
|
||||||
preserve []string (default \[dq]mode\[dq])
|
preview bool (default true)
|
||||||
preview bool (default true)
|
previewer string (default \[aq]\[aq])
|
||||||
previewer string (default \[aq]\[aq])
|
promptfmt string (default \[dq]\[rs]033[32;1m%u\[at]%h\[rs]033[0m:\[rs]033[34;1m%d\[rs]033[0m\[rs]033[1m%f\[rs]033[0m\[dq])
|
||||||
promptfmt string (default \[dq]\[rs]033[32;1m%u\[at]%h\[rs]033[0m:\[rs]033[34;1m%d\[rs]033[0m\[rs]033[1m%f\[rs]033[0m\[dq])
|
ratios []int (default \[aq]1:2:3\[aq])
|
||||||
ratios []int (default \[aq]1:2:3\[aq])
|
relativenumber bool (default false)
|
||||||
relativenumber bool (default false)
|
reverse bool (default false)
|
||||||
reverse bool (default false)
|
roundbox bool (default false)
|
||||||
roundbox bool (default false)
|
ruler []string (default \[aq]acc:progress:selection:filter:ind\[aq])
|
||||||
ruler []string (default \[aq]acc:progress:selection:filter:ind\[aq])
|
rulerfmt string (default \[dq] %a| %p| \[rs]033[7;31m %m \[rs]033[0m| \[rs]033[7;33m %c \[rs]033[0m| \[rs]033[7;35m %s \[rs]033[0m| \[rs]033[7;34m %f \[rs]033[0m| %i/%t\[dq])
|
||||||
rulerfmt string (default \[dq] %a| %p| \[rs]033[7;31m %m \[rs]033[0m| \[rs]033[7;33m %c \[rs]033[0m| \[rs]033[7;35m %s \[rs]033[0m| \[rs]033[7;34m %f \[rs]033[0m| %i/%t\[dq])
|
scrolloff int (default 0)
|
||||||
scrolloff int (default 0)
|
selectfmt string (default \[dq]\[rs]033[7;35m\[dq])
|
||||||
selectfmt string (default \[dq]\[rs]033[7;35m\[dq])
|
selmode string (default \[aq]all\[aq])
|
||||||
selmode string (default \[aq]all\[aq])
|
shell string (default \[aq]sh\[aq] for Unix and \[aq]cmd\[aq] for Windows)
|
||||||
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)
|
||||||
shellflag string (default \[aq]-c\[aq] for Unix and \[aq]/c\[aq] for Windows)
|
shellopts []string (default \[aq]\[aq])
|
||||||
shellopts []string (default \[aq]\[aq])
|
sixel bool (default false)
|
||||||
sixel bool (default false)
|
smartcase bool (default true)
|
||||||
smartcase bool (default true)
|
smartdia bool (default false)
|
||||||
smartdia bool (default false)
|
sortby string (default \[aq]natural\[aq])
|
||||||
sortby string (default \[aq]natural\[aq])
|
statfmt string (default \[dq]\[rs]033[36m%p\[rs]033[0m| %c| %u| %g| %S| %t| -> %l\[dq])
|
||||||
statfmt string (default \[dq]\[rs]033[36m%p\[rs]033[0m| %c| %u| %g| %S| %t| -> %l\[dq])
|
tabstop int (default 8)
|
||||||
tabstop int (default 8)
|
tagfmt string (default \[dq]\[rs]033[31m\[dq])
|
||||||
tagfmt string (default \[dq]\[rs]033[31m\[dq])
|
tempmarks string (default \[aq]\[aq])
|
||||||
tempmarks string (default \[aq]\[aq])
|
timefmt string (default \[aq]Mon Jan _2 15:04:05 2006\[aq])
|
||||||
timefmt string (default \[aq]Mon Jan _2 15:04:05 2006\[aq])
|
truncatechar string (default \[aq]\[ti]\[aq])
|
||||||
truncatechar string (default \[aq]\[ti]\[aq])
|
truncatepct int (default 100)
|
||||||
truncatepct int (default 100)
|
waitmsg string (default \[aq]Press any key to continue\[aq])
|
||||||
waitmsg string (default \[aq]Press any key to continue\[aq])
|
watch bool (default false)
|
||||||
watch bool (default false)
|
wrapscan bool (default true)
|
||||||
wrapscan bool (default true)
|
wrapscroll bool (default false)
|
||||||
wrapscroll bool (default false)
|
user_{option} string (default none)
|
||||||
user_{option} string (default none)
|
|
||||||
\f[R]
|
\f[R]
|
||||||
.fi
|
.fi
|
||||||
.PP
|
.PP
|
||||||
@@ -254,6 +253,8 @@ rename
|
|||||||
delete
|
delete
|
||||||
pre-cd
|
pre-cd
|
||||||
on-cd
|
on-cd
|
||||||
|
on-focus-gained
|
||||||
|
on-focus-lost
|
||||||
on-select
|
on-select
|
||||||
on-redraw
|
on-redraw
|
||||||
on-quit
|
on-quit
|
||||||
@@ -848,9 +849,6 @@ In addition, if a pattern starts with \f[C]!\f[R], then its matches are
|
|||||||
excluded from hidden files.
|
excluded from hidden files.
|
||||||
To add multiple patterns, use \f[C]:\f[R] as a separator.
|
To add multiple patterns, use \f[C]:\f[R] as a separator.
|
||||||
Example: \f[C].*:lost+found:*.bak\f[R]
|
Example: \f[C].*:lost+found:*.bak\f[R]
|
||||||
.SS hidecursorinactive (bool) (default false)
|
|
||||||
.PP
|
|
||||||
Hide the cursor when the terminal or tmux pane loses focus.
|
|
||||||
.SS history (bool) (default true)
|
.SS history (bool) (default true)
|
||||||
.PP
|
.PP
|
||||||
Save command history.
|
Save command history.
|
||||||
@@ -1269,6 +1267,14 @@ directory.
|
|||||||
.PP
|
.PP
|
||||||
This shell command can be defined to be executed after changing a
|
This shell command can be defined to be executed after changing a
|
||||||
directory.
|
directory.
|
||||||
|
.SS on-focus-gained
|
||||||
|
.PP
|
||||||
|
This shell command can be defined to be executed when the terminal gains
|
||||||
|
focus.
|
||||||
|
.SS on-focus-lost
|
||||||
|
.PP
|
||||||
|
This shell command can be defined to be executed when the terminal loses
|
||||||
|
focus.
|
||||||
.SS on-select
|
.SS on-select
|
||||||
.PP
|
.PP
|
||||||
This shell command can be defined to be executed after the selection
|
This shell command can be defined to be executed after the selection
|
||||||
|
|||||||
@@ -30,79 +30,78 @@ func isValidSortMethod(method sortMethod) bool {
|
|||||||
const invalidSortErrorMessage = `sortby: value should either be 'natural', 'name', 'size', 'time', 'atime', 'ctime' or 'ext'`
|
const invalidSortErrorMessage = `sortby: value should either be 'natural', 'name', 'size', 'time', 'atime', 'ctime' or 'ext'`
|
||||||
|
|
||||||
var gOpts struct {
|
var gOpts struct {
|
||||||
anchorfind bool
|
anchorfind bool
|
||||||
autoquit bool
|
autoquit bool
|
||||||
borderfmt string
|
borderfmt string
|
||||||
copyfmt string
|
copyfmt string
|
||||||
cursoractivefmt string
|
cursoractivefmt string
|
||||||
cursorparentfmt string
|
cursorparentfmt string
|
||||||
cursorpreviewfmt string
|
cursorpreviewfmt string
|
||||||
cutfmt string
|
cutfmt string
|
||||||
hidecursorinactive bool
|
dircache bool
|
||||||
dircache bool
|
dircounts bool
|
||||||
dircounts bool
|
dirfirst bool
|
||||||
dirfirst bool
|
dironly bool
|
||||||
dironly bool
|
dirpreviews bool
|
||||||
dirpreviews bool
|
drawbox bool
|
||||||
drawbox bool
|
dupfilefmt string
|
||||||
dupfilefmt string
|
globfilter bool
|
||||||
globfilter bool
|
globsearch bool
|
||||||
globsearch bool
|
hidden bool
|
||||||
hidden bool
|
icons bool
|
||||||
icons bool
|
ignorecase bool
|
||||||
ignorecase bool
|
ignoredia bool
|
||||||
ignoredia bool
|
incfilter bool
|
||||||
incfilter bool
|
incsearch bool
|
||||||
incsearch bool
|
mouse bool
|
||||||
mouse bool
|
number bool
|
||||||
number bool
|
preview bool
|
||||||
preview bool
|
relativenumber bool
|
||||||
relativenumber bool
|
reverse bool
|
||||||
reverse bool
|
roundbox bool
|
||||||
roundbox bool
|
selectfmt string
|
||||||
selectfmt string
|
sixel bool
|
||||||
sixel bool
|
sortby sortMethod
|
||||||
sortby sortMethod
|
smartcase bool
|
||||||
smartcase bool
|
smartdia bool
|
||||||
smartdia bool
|
waitmsg string
|
||||||
waitmsg string
|
watch bool
|
||||||
watch bool
|
wrapscan bool
|
||||||
wrapscan bool
|
wrapscroll bool
|
||||||
wrapscroll bool
|
findlen int
|
||||||
findlen int
|
period int
|
||||||
period int
|
scrolloff int
|
||||||
scrolloff int
|
tabstop int
|
||||||
tabstop int
|
errorfmt string
|
||||||
errorfmt string
|
filesep string
|
||||||
filesep string
|
ifs string
|
||||||
ifs string
|
previewer string
|
||||||
previewer string
|
cleaner string
|
||||||
cleaner string
|
promptfmt string
|
||||||
promptfmt string
|
selmode string
|
||||||
selmode string
|
shell string
|
||||||
shell string
|
shellflag string
|
||||||
shellflag string
|
statfmt string
|
||||||
statfmt string
|
timefmt string
|
||||||
timefmt string
|
infotimefmtnew string
|
||||||
infotimefmtnew string
|
infotimefmtold string
|
||||||
infotimefmtold string
|
truncatechar string
|
||||||
truncatechar string
|
truncatepct int
|
||||||
truncatepct int
|
ratios []int
|
||||||
ratios []int
|
hiddenfiles []string
|
||||||
hiddenfiles []string
|
history bool
|
||||||
history bool
|
info []string
|
||||||
info []string
|
ruler []string
|
||||||
ruler []string
|
rulerfmt string
|
||||||
rulerfmt string
|
preserve []string
|
||||||
preserve []string
|
shellopts []string
|
||||||
shellopts []string
|
keys map[string]expr
|
||||||
keys map[string]expr
|
cmdkeys map[string]expr
|
||||||
cmdkeys map[string]expr
|
cmds map[string]expr
|
||||||
cmds map[string]expr
|
user map[string]string
|
||||||
user map[string]string
|
tempmarks string
|
||||||
tempmarks string
|
numberfmt string
|
||||||
numberfmt string
|
tagfmt string
|
||||||
tagfmt string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var gLocalOpts struct {
|
var gLocalOpts struct {
|
||||||
@@ -193,7 +192,6 @@ func init() {
|
|||||||
gOpts.cursorparentfmt = "\033[7m"
|
gOpts.cursorparentfmt = "\033[7m"
|
||||||
gOpts.cursorpreviewfmt = "\033[4m"
|
gOpts.cursorpreviewfmt = "\033[4m"
|
||||||
gOpts.cutfmt = "\033[7;31m"
|
gOpts.cutfmt = "\033[7;31m"
|
||||||
gOpts.hidecursorinactive = false
|
|
||||||
gOpts.globfilter = false
|
gOpts.globfilter = false
|
||||||
gOpts.globsearch = false
|
gOpts.globsearch = false
|
||||||
gOpts.hidden = false
|
gOpts.hidden = false
|
||||||
|
|||||||
@@ -484,7 +484,7 @@ func (win *win) printDir(ui *ui, dir *dir, context *dirContext, dirStyle *dirSty
|
|||||||
}
|
}
|
||||||
|
|
||||||
ce := ""
|
ce := ""
|
||||||
if i == dir.pos && (ui.focused || !gOpts.hidecursorinactive) {
|
if i == dir.pos {
|
||||||
switch dirStyle.role {
|
switch dirStyle.role {
|
||||||
case Active:
|
case Active:
|
||||||
ce = gOpts.cursoractivefmt
|
ce = gOpts.cursoractivefmt
|
||||||
@@ -564,7 +564,6 @@ type ui struct {
|
|||||||
screen tcell.Screen
|
screen tcell.Screen
|
||||||
sxScreen sixelScreen
|
sxScreen sixelScreen
|
||||||
polling bool
|
polling bool
|
||||||
focused bool
|
|
||||||
wins []*win
|
wins []*win
|
||||||
promptWin *win
|
promptWin *win
|
||||||
msgWin *win
|
msgWin *win
|
||||||
@@ -596,7 +595,6 @@ func newUI(screen tcell.Screen) *ui {
|
|||||||
ui := &ui{
|
ui := &ui{
|
||||||
screen: screen,
|
screen: screen,
|
||||||
polling: true,
|
polling: true,
|
||||||
focused: true,
|
|
||||||
wins: getWins(screen),
|
wins: getWins(screen),
|
||||||
promptWin: newWin(wtot, 1, 0, 0),
|
promptWin: newWin(wtot, 1, 0, 0),
|
||||||
msgWin: newWin(wtot, 1, 0, htot-1),
|
msgWin: newWin(wtot, 1, 0, htot-1),
|
||||||
@@ -1463,8 +1461,11 @@ func (ui *ui) readNormalEvent(ev tcell.Event, nav *nav) expr {
|
|||||||
case *tcell.EventInterrupt:
|
case *tcell.EventInterrupt:
|
||||||
log.Printf("Got EventInterrupt: at %s", tev.When())
|
log.Printf("Got EventInterrupt: at %s", tev.When())
|
||||||
case *tcell.EventFocus:
|
case *tcell.EventFocus:
|
||||||
ui.focused = tev.Focused
|
if tev.Focused {
|
||||||
return draw
|
return &callExpr{"on-focus-gained", nil, 1}
|
||||||
|
} else {
|
||||||
|
return &callExpr{"on-focus-lost", nil, 1}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user