Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
19 changes: 19 additions & 0 deletions plugins/zeal_search.lua
Original file line number Diff line number Diff line change
@@ -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,

})