techhub.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
A hub primarily for passionate technologists, but everyone is welcome

Administered by:

Server stats:

5.2K
active users

#lazygit

1 post1 participant0 posts today

Didn't think that I'll be impressed by a terminal app since I'm not the hardcore keyboard coder. But #lazygit (and #lazydocker) are impressive tools, especially for quick rebases in my own branch, amending, squashing and splitting commits via patch. 1/

github.com/jesseduffield/lazyg
#opensource #git

simple terminal UI for git commands. Contribute to jesseduffield/lazygit development by creating an account on GitHub.
GitHubGitHub - jesseduffield/lazygit: simple terminal UI for git commandssimple terminal UI for git commands. Contribute to jesseduffield/lazygit development by creating an account on GitHub.
Continued thread

A new version of lazyvim-confirm. (Should I turn this into a proper #NeoVim plugin?)

vim.keymap.set("n", "<leader>gg", function()
local unsaved_table = {}
local choice = 1
for _, buf_id in ipairs(vim.api.nvim_list_bufs()) do
if vim.api.nvim_get_option_value("modified", { buf = buf_id }) then
table.insert(unsaved_table, string.format("%3d", buf_id) .. ": " .. vim.api.nvim_buf_get_name(buf_id))
end
end
if #unsaved_table ~= 0 then
choice = vim.fn.confirm(
"There are unsaved buffers:\n\n" .. table.concat(unsaved_table, "\n") .. "\n\nDo you still want to run lazygit?",
"&Yes\n&No\nShow &Buffers",
2
)
end
if choice == 1 then
Snacks.lazygit()
elseif choice == 3 then
vim.cmd([[FzfLua buffers sort_mru=true sort_lastused=true]])
end
end, { noremap = true })

EDIT: Hacked together solution in next post.

#NeoVim HIVEMIND: #LazyVim has the nice shortcut <leader>gg, which launches #lazygit in a window. However, I would like NeoVim to warn me if any buffers are unsaved before launching lazygit.

I forget far too often and end up committing most of my changes but not all of them, because I've forgotten to save my buffer.

Does anyone have any idea what I should be looking for? I guess I need (with very bad pseudocode):

if unsaved_buffers then
confirm = dialog("There are unsaved buffers. Do you still want to launch lazygit?")
if !confirm then
return
endif
endif

launch_in_window(lazygit) // or send <leader>gg

If #lazygit didn't exist I would switch my workflow to using #jj /#jujutsu, it is realllly nice. Spent a week using it and was incredibly satisfied with how it all worked once I got my head out of git mode. People who use the cli to use #git I strongly encourage you to check it out. (My brain is just too hard-wired to the lazygit keybinds)