mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
open official website for extra of current line
This commit is contained in:
parent
11268d8ff1
commit
1476f0d277
1 changed files with 13 additions and 0 deletions
|
|
@ -144,6 +144,9 @@ function X.new()
|
||||||
self.float:on_key("x", function()
|
self.float:on_key("x", function()
|
||||||
self:toggle()
|
self:toggle()
|
||||||
end, "Toggle extra")
|
end, "Toggle extra")
|
||||||
|
self:on_key("o", function()
|
||||||
|
self:open()
|
||||||
|
end, "Open extra document")
|
||||||
self.diag = {}
|
self.diag = {}
|
||||||
self:update()
|
self:update()
|
||||||
return self
|
return self
|
||||||
|
|
@ -156,6 +159,16 @@ function X:diagnostic(diag)
|
||||||
table.insert(self.diag, diag)
|
table.insert(self.diag, diag)
|
||||||
end
|
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()
|
function X:toggle()
|
||||||
local pos = vim.api.nvim_win_get_cursor(self.float.win)
|
local pos = vim.api.nvim_win_get_cursor(self.float.win)
|
||||||
for _, extra in ipairs(self.extras) do
|
for _, extra in ipairs(self.extras) do
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue