diff options
| author | Amirreza Askarpour <raskarpour@gmail.com> | 2021-05-11 12:50:57 +0430 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-11 10:20:57 +0200 |
| commit | 9fd242db260a63d8b788d1edbabd2d76a55a2d61 (patch) | |
| tree | 82a47db9b567a0be1acfb3ccee129b1ff53e0e6a /lua/telescope/builtin/git.lua | |
| parent | c061c216bfe082384d542a487ce02e9aed6177df (diff) | |
feat: add git_stash picker (#800)
Diffstat (limited to 'lua/telescope/builtin/git.lua')
| -rw-r--r-- | lua/telescope/builtin/git.lua | 19 |
1 files changed, 19 insertions, 0 deletions
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('%') |
