added gitsigns blame and zenmode hotkeys
This commit is contained in:
@ -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 `
|
||||
@ -46,7 +66,7 @@ which_key.setup({
|
||||
end,
|
||||
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
|
||||
triggers = { },
|
||||
triggers = {},
|
||||
-- disable the WhichKey popup for certain buf types and file types.
|
||||
-- Disabled by default for Telescope
|
||||
disable = {
|
||||
@ -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" },
|
||||
|
||||
Reference in New Issue
Block a user