Skip to content

Commit

Permalink
wip(ui): stash list
Browse files Browse the repository at this point in the history
  • Loading branch information
AlphabetsAlphabets committed Apr 13, 2024
1 parent c9e8b55 commit ea74fda
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 3 deletions.
37 changes: 37 additions & 0 deletions lua/neogit/buffers/stash_list_view/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
local Buffer = require("neogit.lib.buffer")
local ui = require("neogit.buffers.log_view.ui")
local config = require("neogit.config")
local popups = require("neogit.popups")
local notification = require("neogit.lib.notification")
local status_maps = require("neogit.config").get_reversed_status_maps()
local CommitViewBuffer = require("neogit.buffers.commit_view")

local M = {}

function M.close()
self.buffer:close()
self.buffer = nil
end

function M.open()
self.buffer = Buffer.create {
name = "NeogitStashListView",
filetype = "NeogitStashView",
kind = config.values.stash.kind,
context_higlight = true,
mappings = {
["q"] = function()
self:close()
end,
["<esc>"] = function()
self:close()
end,
["<enter>"] = function()
-- Still looking for how to view a stash
-- CommitViewBuffer.new(self.buffer.ui:get_commit_under_cursor(), self.files):open()
end,
}
}
end

return M
3 changes: 3 additions & 0 deletions lua/neogit/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,9 @@ function M.get_default_values()
popup = {
kind = "split",
},
stash = {
kind = "split",
},
signs = {
hunk = { "", "" },
item = { ">", "v" },
Expand Down
4 changes: 2 additions & 2 deletions lua/neogit/popups/stash/actions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ function M.drop(popup)
use("drop", popup.state.env.stash)
end

function M.list(popup)
M.list = operation("stash list", function(popup)
use("list", popup.state.env.stash)
end
end)

M.rename = operation("stash_rename", function(popup)
use("rename", popup.state.env.stash)
Expand Down
2 changes: 1 addition & 1 deletion lua/neogit/popups/stash/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function M.create(stash)
:action("d", "drop", actions.drop)
:new_action_group("Inspect")
-- Only way to add functionality is to add `actions.list` to `stash/actions.lua`
:action("l", "List")
:action("l", "List", actions.list)
:action("v", "Show")
:new_action_group("Transform")
:action("b", "Branch")
Expand Down

0 comments on commit ea74fda

Please sign in to comment.