diff --git a/lazy-lock.json b/lazy-lock.json index 5583e4f..2886e95 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -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" }, diff --git a/lua/plugins/editor.lua b/lua/plugins/editor.lua index 37d18b2..9984ef4 100644 --- a/lua/plugins/editor.lua +++ b/lua/plugins/editor.lua @@ -44,6 +44,14 @@ return { }, }, + -- Surround + { + "kylechui/nvim-surround", + version = "*", + event = "VeryLazy", + opts = {}, + }, + -- Supermaven AI completion { "supermaven-inc/supermaven-nvim", diff --git a/lua/plugins/fzf.lua b/lua/plugins/fzf.lua index eb00fb1..0bcf536 100644 --- a/lua/plugins/fzf.lua +++ b/lua/plugins/fzf.lua @@ -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 = ":: 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 { { "GB", function() require("fzf-lua").git_branches() end, desc = "Git branches" }, { "Gc", function() require("fzf-lua").git_commits() end, desc = "Git commits" }, { "Gs", function() require("fzf-lua").git_status() end, desc = "Git status" }, + { "Gp", function() gh_picker("pr", "open") end, desc = "GitHub PRs" }, + { "Gi", function() gh_picker("issue", "open") end, desc = "GitHub issues" }, }, opts = { "default-title",