feat(extras): added extra for octo.nvim. Make sure to update lazy.nvim, which-key.nvim and also update tokyonight if you use that theme.

This commit is contained in:
Folke Lemaitre 2024-06-06 12:24:49 +02:00
parent 91a5fc10e6
commit 100c5793c8
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
2 changed files with 56 additions and 2 deletions

View file

@ -0,0 +1,51 @@
return {
-- depends on the git extra for highlighting and auto-completion of github issues/prs
{ import = "lazyvim.plugins.extras.lang.git" },
-- Octo
{
"pwntester/octo.nvim",
cmd = "Octo",
init = function()
vim.treesitter.language.register("markdown", "octo")
end,
opts = {
enable_builtin = true,
default_to_projects_v2 = true,
default_merge_method = "squash",
picker = "telescope",
},
keys = {
{ "<leader>gi", "<cmd>Octo issue list<CR>", desc = "List Isues (Octo)" },
{ "<leader>gI", "<cmd>Octo issue search<CR>", desc = "Search Isues (Octo)" },
{ "<leader>gp", "<cmd>Octo pr list<CR>", desc = "List PRs (Octo)" },
{ "<leader>gP", "<cmd>Octo pr search<CR>", desc = "Search PRs (Octo)" },
{ "<leader>gr", "<cmd>Octo repo list<CR>", desc = "List Repos (Octo)" },
{ "<leader>gS", "<cmd>Octo search<CR>", desc = "Search (Octo)" },
{ "<leader>a", "", desc = "+assignee (Otco)", ft = "octo" },
{ "<leader>c", "", desc = "+comment/code (Otco)", ft = "octo" },
{ "<leader>l", "", desc = "+label (Otco)", ft = "octo" },
{ "<leader>i", "", desc = "+issue (Otco)", ft = "octo" },
{ "<leader>r", "", desc = "+react (Otco)", ft = "octo" },
{ "<leader>p", "", desc = "+pr (Otco)", ft = "octo" },
{ "<leader>v", "", desc = "+review (Otco)", ft = "octo" },
{ "@", "@<C-x><C-o>", mode = "i", ft = "octo", silent = true },
{ "#", "#<C-x><C-o>", mode = "i", ft = "octo", silent = true },
},
},
-- Octo Picker
{
"pwntester/octo.nvim",
opts = function(_, opts)
if LazyVim.has("telescope.nvim") then
opts.picker = "telescope"
elseif LazyVim.has("fzf-lua") then
opts.picker = "fzf-lua"
else
LazyVim.error("`octo.nvim` requires `telescope.nvim` or `fzf-lua`")
end
end,
},
}

View file

@ -34,7 +34,7 @@ function M.get_signs(buf, lnum)
)
for _, extmark in pairs(extmarks) do
signs[#signs + 1] = {
name = extmark[4].sign_hl_group or "",
name = extmark[4].sign_hl_group or extmark[4].sign_name or "",
text = extmark[4].sign_text,
texthl = extmark[4].sign_hl_group,
priority = extmark[4].priority,
@ -106,6 +106,9 @@ function M.statuscolumn()
---@type Sign?,Sign?,Sign?
local left, right, fold, githl
for _, s in ipairs(M.get_signs(buf, vim.v.lnum)) do
if s.name and s.name:lower():find("^octo_clean") then
s.texthl = "IblScope"
end
if s.name and (s.name:find("GitSign") or s.name:find("MiniDiffSign")) then
right = s
if use_githl then
@ -115,7 +118,7 @@ function M.statuscolumn()
left = s
end
end
if vim.v.virtnum ~= 0 then
if vim.v.virtnum ~= 0 and vim.bo[buf].filetype ~= "octo" then
left = nil
end