From 9fd242db260a63d8b788d1edbabd2d76a55a2d61 Mon Sep 17 00:00:00 2001 From: Amirreza Askarpour Date: Tue, 11 May 2021 12:50:57 +0430 Subject: feat: add git_stash picker (#800) --- lua/telescope/builtin/git.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'lua/telescope/builtin/git.lua') diff --git a/lua/telescope/builtin/git.lua b/lua/telescope/builtin/git.lua index d708126..77bacd0 100644 --- a/lua/telescope/builtin/git.lua +++ b/lua/telescope/builtin/git.lua @@ -57,6 +57,25 @@ git.commits = function(opts) }):find() end +git.stash = function(opts) + local results = utils.get_os_command_output({ + 'git', '--no-pager', 'stash', 'list', + }, opts.cwd) + + pickers.new(opts, { + prompt_title = 'Git Stash', + finder = finders.new_table { + results = results, + entry_maker = opts.entry_maker or make_entry.gen_from_git_stash(), + }, + previewer = previewers.git_stash_diff.new(opts), + sorter = conf.file_sorter(opts), + attach_mappings = function() + actions.select_default:replace(actions.git_apply_stash) + return true + end + }):find() +end git.bcommits = function(opts) local results = utils.get_os_command_output({ 'git', 'log', '--pretty=oneline', '--abbrev-commit', vim.fn.expand('%') -- cgit v1.2.3