nvim keys for gitsigns

This commit is contained in:
TheK4n 2023-01-23 21:54:06 +03:00
parent cdbf41230d
commit cb848505ba
2 changed files with 21 additions and 12 deletions

View File

@ -3,15 +3,3 @@ local status, trouble = pcall(require, "trouble")
if (not status) then return end if (not status) then return end
trouble.setup() trouble.setup()
local function set_trouble_keymap(key, cmd)
local opts = {silent = true, noremap = true}
vim.keymap.set("n", string.format("<Leader>x%s", key), cmd, opts)
end
set_trouble_keymap("x", "<cmd>TroubleToggle<cr>")
set_trouble_keymap("w", "<cmd>TroubleToggle workspace_diagnostics<cr>")
set_trouble_keymap("d", "<cmd>TroubleToggle document_diagnostics<cr>")
set_trouble_keymap("l", "<cmd>TroubleToggle loclist<cr>")
set_trouble_keymap("q", "<cmd>TroubleToggle quickfix<cr>")

View File

@ -95,3 +95,24 @@ end
-- Toggle line number style -- Toggle line number style
map('n', '<Leader>l', create_function_tabdo('lua toggle_number_style()'), opts) map('n', '<Leader>l', create_function_tabdo('lua toggle_number_style()'), opts)
local function set_trouble_keymap(key, cmd)
map("n", string.format("<Leader>x%s", key), string.format("<cmd>TroubleToggle %s<CR>", cmd), opts)
end
set_trouble_keymap("x", "")
set_trouble_keymap("w", "workspace_diagnostics")
set_trouble_keymap("d", "document_diagnostics")
set_trouble_keymap("l", "loclist")
set_trouble_keymap("q", "quickfix")
local function set_gitsigns_keymap(key, cmd)
map("n", string.format("<Leader>g%s", key), string.format("<cmd>Gitsigns %s<CR>", cmd), opts)
end
set_gitsigns_keymap('p', 'preview_hunk')
set_gitsigns_keymap('b', 'blame_line')
set_gitsigns_keymap('n', 'next_hunk')