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 return
end 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({ which_key.setup({
plugins = { plugins = {
marks = false, -- shows a list of your marks on ' and ` marks = false, -- shows a list of your marks on ' and `
@ -46,7 +66,7 @@ which_key.setup({
end, end,
show_help = true, -- show help message on the command line when the popup is visible show_help = true, -- show help message on the command line when the popup is visible
show_keys = true, -- show the currently pressed key and its label as a message in the command line show_keys = true, -- show the currently pressed key and its label as a message in the command line
triggers = { }, triggers = {},
-- disable the WhichKey popup for certain buf types and file types. -- disable the WhichKey popup for certain buf types and file types.
-- Disabled by default for Telescope -- Disabled by default for Telescope
disable = { disable = {
@ -71,6 +91,15 @@ which_key.add({
{ "<leader>fh", "<cmd>lua require'telescope.builtin'.resume()<cr>", desc = "Resume last search" }, { "<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({ which_key.add({
{ "<leader>c", group = "Code actions" }, { "<leader>c", group = "Code actions" },
{ "<leader>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>", desc = "Show code actions" }, { "<leader>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>", desc = "Show code actions" },