mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-18 11:20:07 -04:00
goto_node select last character when in operator-pending mode
This commit is contained in:
parent
53695580e3
commit
df968afd9d
1 changed files with 8 additions and 0 deletions
|
|
@ -452,6 +452,14 @@ function M.goto_node(node, goto_end, avoid_set_jump)
|
||||||
else
|
else
|
||||||
position = { range[3], range[4] }
|
position = { range[3], range[4] }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Enter visual mode if we are in operator pending mode
|
||||||
|
-- If we don't do this, it will miss the last character.
|
||||||
|
local mode = vim.api.nvim_get_mode()
|
||||||
|
if mode.mode == "no" then
|
||||||
|
vim.cmd "normal! v"
|
||||||
|
end
|
||||||
|
|
||||||
-- Position is 1, 0 indexed.
|
-- Position is 1, 0 indexed.
|
||||||
api.nvim_win_set_cursor(0, { position[1], position[2] - 1 })
|
api.nvim_win_set_cursor(0, { position[1], position[2] - 1 })
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue