From de7ac64e742c21afae5dae93e8207408fde5042c Mon Sep 17 00:00:00 2001 From: bhagwan Date: Thu, 12 May 2022 16:37:59 -0700 Subject: [PATCH] feat: new action 'git_stash_pop' (#410) --- lua/fzf-lua/actions.lua | 8 ++++++++ lua/fzf-lua/config.lua | 1 + 2 files changed, 9 insertions(+) diff --git a/lua/fzf-lua/actions.lua b/lua/fzf-lua/actions.lua index 53c5c60..33ccd84 100644 --- a/lua/fzf-lua/actions.lua +++ b/lua/fzf-lua/actions.lua @@ -508,6 +508,14 @@ M.git_stash_drop = function(selected, opts) git_exec(selected, opts, cmd) end +M.git_stash_pop = function(selected, opts) + if vim.fn.input("Pop " .. #selected .. " stash(es)? [y/n] ") == "y" then + local cmd = path.git_cwd({"git", "stash", "pop"}, opts) + git_exec(selected, opts, cmd) + vim.cmd("e!") + end +end + M.git_stash_apply = function(selected, opts) if vim.fn.input("Apply " .. #selected .. " stash(es)? [y/n] ") == "y" then local cmd = path.git_cwd({"git", "stash", "apply"}, opts) diff --git a/lua/fzf-lua/config.lua b/lua/fzf-lua/config.lua index 19dd1f3..f070548 100644 --- a/lua/fzf-lua/config.lua +++ b/lua/fzf-lua/config.lua @@ -883,6 +883,7 @@ M._action_to_helpstr = { [actions.git_stage] = "git-stage", [actions.git_unstage] = "git-unstage", [actions.git_reset] = "git-reset", + [actions.git_stash_pop] = "git-stash-pop", [actions.git_stash_drop] = "git-stash-drop", [actions.git_stash_apply] = "git-stash-apply", [actions.git_buf_edit] = "git-buffer-edit",