mirror of
https://github.com/lewis6991/gitsigns.nvim
synced 2025-02-20 22:47:23 +00:00
fix(select_hunk): compatible with <cmd> mapping
This commit is contained in:
parent
71e8204f91
commit
8974fd397e
@ -181,7 +181,7 @@ require('gitsigns').setup{
|
||||
map('n', '<leader>tw', gitsigns.toggle_word_diff)
|
||||
|
||||
-- Text object
|
||||
map({'o', 'x'}, 'ih', ':<C-U>Gitsigns select_hunk<CR>')
|
||||
map({'o', 'x'}, 'ih', '<cmd>Gitsigns select_hunk<CR>')
|
||||
end
|
||||
}
|
||||
```
|
||||
|
@ -951,7 +951,11 @@ M.select_hunk = function(opts)
|
||||
return
|
||||
end
|
||||
|
||||
vim.cmd('normal! ' .. hunk.added.start .. 'GV' .. hunk.vend .. 'G')
|
||||
if vim.fn.mode():find('v') ~= nil then
|
||||
vim.cmd('normal! ' .. hunk.added.start .. 'GoV' .. hunk.vend .. 'G')
|
||||
else
|
||||
vim.cmd('normal! ' .. hunk.added.start .. 'GV' .. hunk.vend .. 'G')
|
||||
end
|
||||
end
|
||||
|
||||
--- Get hunk array for specified buffer.
|
||||
|
Loading…
Reference in New Issue
Block a user