added gitsigns blame and zenmode hotkeys

This commit is contained in:
2025-06-22 22:52:35 +05:00
parent 20ed4e7d79
commit fe92b658ea

View File

@ -3,6 +3,26 @@ if not status_ok then
return
end
local toggle_gitsigns_blame = function()
local function is_filetype_open(filetype)
for _, buf in ipairs(vim.api.nvim_list_bufs()) do
if vim.api.nvim_buf_is_loaded(buf) and vim.bo[buf].filetype == filetype then
return buf
end
end
return nil
end
-- check if gitsigns-blame buffer is open
local bufnr = is_filetype_open("gitsigns-blame")
if bufnr then
vim.api.nvim_buf_delete(bufnr, { force = false })
else
vim.cmd("Gitsigns blame")
end
end
which_key.setup({
plugins = {
marks = false, -- shows a list of your marks on ' and `
@ -71,6 +91,15 @@ which_key.add({
{ "<leader>fh", "<cmd>lua require'telescope.builtin'.resume()<cr>", desc = "Resume last search" },
})
which_key.add({
{ "<leader>g", group = "Git" },
{ "<leader>gb", toggle_gitsigns_blame, desc = "Toggle git blame view" },
})
which_key.add({
{ "<leader>z", "<cmd>:ZenMode<CR>", desc = "Zen mode toggle" },
})
which_key.add({
{ "<leader>c", group = "Code actions" },
{ "<leader>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>", desc = "Show code actions" },