Skip to content

Commit

Permalink
Update tab callback
Browse files Browse the repository at this point in the history
  • Loading branch information
CKolkey committed Nov 28, 2023
1 parent f95809a commit 185c69b
Showing 1 changed file with 40 additions and 30 deletions.
70 changes: 40 additions & 30 deletions lua/neogit/buffers/refs_view/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -137,38 +137,48 @@ function M:open()
["<enter>"] = function()
CommitViewBuffer.new(self.buffer.ui:get_commits_in_selection()[1]):open()
end,
["{"] = function()
pcall(vim.cmd, "normal! zc")

vim.cmd("normal! k")
for _ = vim.fn.line("."), 0, -1 do
if vim.fn.foldlevel(".") > 0 then
break
end

vim.cmd("normal! k")
end

pcall(vim.cmd, "normal! zo")
vim.cmd("normal! zz")
end,
["}"] = function()
pcall(vim.cmd, "normal! zc")

vim.cmd("normal! j")
for _ = vim.fn.line("."), vim.fn.line("$"), 1 do
if vim.fn.foldlevel(".") > 0 then
break
-- ["{"] = function()
-- pcall(vim.cmd, "normal! zc")
--
-- vim.cmd("normal! k")
-- for _ = vim.fn.line("."), 0, -1 do
-- if vim.fn.foldlevel(".") > 0 then
-- break
-- end
--
-- vim.cmd("normal! k")
-- end
--
-- pcall(vim.cmd, "normal! zo")
-- vim.cmd("normal! zz")
-- end,
-- ["}"] = function()
-- pcall(vim.cmd, "normal! zc")
--
-- vim.cmd("normal! j")
-- for _ = vim.fn.line("."), vim.fn.line("$"), 1 do
-- if vim.fn.foldlevel(".") > 0 then
-- break
-- end
--
-- vim.cmd("normal! j")
-- end
--
-- pcall(vim.cmd, "normal! zo")
-- vim.cmd("normal! zz")
-- end,
["<tab>"] = function()
local fold = self.buffer.ui:get_fold_under_cursor()
if fold then
if fold.options.on_open then
fold.options.on_open(fold, self.buffer.ui)
else
local ok, _ = pcall(vim.cmd, "normal! za")
if ok then
fold.options.folded = not fold.options.folded
end
end

vim.cmd("normal! j")
end

pcall(vim.cmd, "normal! zo")
vim.cmd("normal! zz")
end,
["<tab>"] = function()
pcall(vim.cmd, "normal! za")
end,
["d"] = function()
if not config.check_integration("diffview") then
Expand Down

0 comments on commit 185c69b

Please sign in to comment.