custom pr view

This commit is contained in:
Harivansh Rathi 2026-02-17 17:40:23 -05:00
parent e7e0a25ab4
commit 98989e9475
3 changed files with 37 additions and 0 deletions

View file

@ -14,6 +14,7 @@
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
"nvim-autopairs": { "branch": "master", "commit": "59bce2eef357189c3305e25bc6dd2d138c1683f5" },
"nvim-lspconfig": { "branch": "master", "commit": "44acfe887d4056f704ccc4f17513ed41c9e2b2e6" },
"nvim-surround": { "branch": "main", "commit": "1098d7b3c34adcfa7feb3289ee434529abd4afd1" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-treesitter-textobjects": { "branch": "main", "commit": "a0e182ae21fda68c59d1f36c9ed45600aef50311" },
"nvim-web-devicons": { "branch": "master", "commit": "746ffbb17975ebd6c40142362eee1b0249969c5c" },

View file

@ -44,6 +44,14 @@ return {
},
},
-- Surround
{
"kylechui/nvim-surround",
version = "*",
event = "VeryLazy",
opts = {},
},
-- Supermaven AI completion
{
"supermaven-inc/supermaven-nvim",

View file

@ -1,3 +1,29 @@
---@param kind 'issue'|'pr'
---@param state 'all'|'open'|'closed'
local function gh_picker(kind, state)
if vim.fn.executable("gh") ~= 1 then
vim.notify("gh CLI not found", vim.log.levels.WARN)
return
end
local next_state = ({ all = "open", open = "closed", closed = "all" })[state]
local label = kind == "pr" and "PRs" or "Issues"
require("fzf-lua").fzf_exec(("gh %s list --limit 100 --state %s"):format(kind, state), {
prompt = ("%s (%s)> "):format(label, state),
header = ":: <c-o> to toggle all/open/closed",
actions = {
["default"] = function(selected)
local num = selected[1]:match("^#?(%d+)")
if num then
vim.system({ "gh", kind, "view", num, "--web" })
end
end,
["ctrl-o"] = function()
gh_picker(kind, next_state)
end,
},
})
end
return {
"ibhagwan/fzf-lua",
dependencies = { "nvim-tree/nvim-web-devicons" },
@ -38,6 +64,8 @@ return {
{ "<leader>GB", function() require("fzf-lua").git_branches() end, desc = "Git branches" },
{ "<leader>Gc", function() require("fzf-lua").git_commits() end, desc = "Git commits" },
{ "<leader>Gs", function() require("fzf-lua").git_status() end, desc = "Git status" },
{ "<leader>Gp", function() gh_picker("pr", "open") end, desc = "GitHub PRs" },
{ "<leader>Gi", function() gh_picker("issue", "open") end, desc = "GitHub issues" },
},
opts = {
"default-title",