diff --git a/README.md b/README.md index 502e1edf..4e5a666e 100644 --- a/README.md +++ b/README.md @@ -84,3 +84,4 @@ Plugin | Description [`togglesnakecamel`](plugins/togglesnakecamel.lua?raw=1) | Toggles symbols between `snake_case` and `camelCase` [`unboundedscroll`](plugins/unboundedscroll.lua?raw=1) | Allows scrolling outside the bounds of a document [`workspace`](plugins/workspace.lua?raw=1) | Retains project's layout and open documents between sessions +[`zeal_search`](plugins/zeal_search.lua?raw=1) | Offline documentation search in Zeal \ No newline at end of file diff --git a/plugins/zeal_search.lua b/plugins/zeal_search.lua new file mode 100644 index 00000000..6278903f --- /dev/null +++ b/plugins/zeal_search.lua @@ -0,0 +1,19 @@ +local core = require "core" +local command = require "core.command" + +command.add("core.docview", { + ["zeal:search"] = function() + -- Make current selected text appear in the search bar + local dv = core.active_view + local sel = { dv.doc:get_selection() } + local text = dv.doc:get_text(table.unpack(sel)) + core.command_view:set_text(text, true) + + -- Ask for user input + core.command_view:enter("Search", function(query) + system.exec("zeal " .. query) + end) + end, + +}) +