feat(nvim): add visual git stage bind
This commit is contained in:
parent
0a0b493de1
commit
fbe8d06de1
2 changed files with 16 additions and 1 deletions
|
@ -161,7 +161,7 @@ in {
|
|||
{
|
||||
plugin = gitsigns-nvim;
|
||||
type = "lua";
|
||||
config = "require('gitsigns').setup()";
|
||||
config = fileContents ./plugins/gitsigns.lua;
|
||||
}
|
||||
{
|
||||
plugin = nvim-autopairs;
|
||||
|
|
15
common/home/neovim/plugins/gitsigns.lua
Normal file
15
common/home/neovim/plugins/gitsigns.lua
Normal file
|
@ -0,0 +1,15 @@
|
|||
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();
|
Loading…
Reference in a new issue