Skip to content
This repository was archived by the owner on May 16, 2024. It is now read-only.

Commit 33ce6a2

Browse files
feat: jump to entry with cmd
jumpt directly to the searched entry when rendering with cmd
1 parent 46ec4c5 commit 33ce6a2

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

lua/nvim-devdocs/operations.lua

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -215,16 +215,15 @@ M.open = function(alias, bufnr, pattern, float)
215215
vim.api.nvim_chan_send(chan, line .. "\r\n")
216216
end
217217
end),
218+
on_exit = vim.schedule_wrap(function()
219+
if pattern then
220+
local formatted_pattern = pattern:gsub("`", "")
221+
vim.defer_fn(function() vim.fn.search(formatted_pattern) end, 500)
222+
end
223+
end),
218224
writer = table.concat(lines, "\n"),
219225
})
220226
previewer:start()
221-
222-
if pattern then
223-
local formatted_pattern = pattern:gsub("`", "")
224-
225-
-- TODO: wait for the rendering before jumping
226-
vim.defer_fn(function() vim.fn.search(formatted_pattern) end, 500)
227-
end
228227
else
229228
vim.bo[bufnr].ft = "markdown"
230229
end

0 commit comments

Comments
 (0)