nixos-configs/common/home/neovim/plugins/gitsigns.lua

16 lines
461 B
Lua
Raw Normal View History

2023-10-30 20:24:47 -04:00
local gitsigns = require("gitsigns")
local function visual_stage()
local first_line = vim.fn.line('v')
local last_line = vim.fn.getpos('.')[2]
gitsigns.stage_hunk({ first_line, last_line })
-- Switch back to normal mode, there may be a cleaner way to do this
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes('<Esc>', true, false, true), 't', false)
end
vim.keymap.set("v", "gbhs", function()
visual_stage()
end)
gitsigns.setup();