Implement more comfortable "find text" UI
This commit is contained in:
parent
d3fc2d1739
commit
998cab3cb8
25
support/lite/plugins/betterfind.lua
Normal file
25
support/lite/plugins/betterfind.lua
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
local core = require "core"
|
||||||
|
local command = require "core.command"
|
||||||
|
local keymap = require "core.keymap"
|
||||||
|
local CommandView = require "core.commandview"
|
||||||
|
|
||||||
|
local function is_finding()
|
||||||
|
return core.active_view:is(CommandView) and core.active_view.label == "Find Text: "
|
||||||
|
end
|
||||||
|
|
||||||
|
command.add(is_finding, {
|
||||||
|
["better-find:done"] = function() core.active_view:submit() end,
|
||||||
|
["better-find:next"] = function()
|
||||||
|
local commandview = core.active_view
|
||||||
|
commandview.state.submit(commandview:get_text())
|
||||||
|
core.set_active_view(core.last_active_view)
|
||||||
|
command.perform("find-replace:repeat-find")
|
||||||
|
core.set_active_view(commandview)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
keymap.add {
|
||||||
|
["escape"] = "better-find:done",
|
||||||
|
["return"] = "better-find:next"
|
||||||
|
}
|
||||||
|
|
1
vendor/lite/data/plugins/betterfind.lua
vendored
Symbolic link
1
vendor/lite/data/plugins/betterfind.lua
vendored
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../../../../support/lite/plugins/betterfind.lua
|
Loading…
Reference in a new issue