diff --git a/lua/lazyvim/util/extras.lua b/lua/lazyvim/util/extras.lua index bd5ca4f3..391ddc90 100644 --- a/lua/lazyvim/util/extras.lua +++ b/lua/lazyvim/util/extras.lua @@ -144,6 +144,9 @@ function X.new() self.float:on_key("x", function() self:toggle() end, "Toggle extra") + self:on_key("o", function() + self:open() + end, "Open extra document") self.diag = {} self:update() return self @@ -156,6 +159,16 @@ function X:diagnostic(diag) table.insert(self.diag, diag) end +function X:open() + local pos = vim.api.nvim_win_get_cursor(self.float.win) + for _, extra in ipairs(self.extras) do + if extra.row == pos[1] then + require("lazy.util").open(("https://www.lazyvim.org/%s"):format(extra.name:gsub("%.", "/"))) + return + end + end +end + function X:toggle() local pos = vim.api.nvim_win_get_cursor(self.float.win) for _, extra in ipairs(self.extras) do