HopYankChar1 - First character is not included in yank
tyetye opened this issue · 2 comments
When using HopYankChar1 the first (leftmost or uppermost) character is not included in the yank.
For example if you have text abcdefgh
and select a
as the start character for the yank and h
as the terminating character then the actual yanked text is bcdefgh
. This behavior is the same h
is selected first then a
.
To Reproduce
Initiate command HopYankChar1
, follow the Yank start pattern
prompt to select a start character. Follow the Yank end pattern
prompt to select the end character. Paste the yanked text to see the result.
Expected behavior
The first character should be included instead of excluded. i.e. from the intro abcdefgh
should be in the yank register.
Screenshots
N/A
version (please complete the following information):
- Nvim version: 0.9.1
- hop.nvim version: 2.3.0
Additional context
No additional comments. But thank you for continuing this plugin!
Exploring this a little more, I think maybe this is intended behavior. "But I don't really like it."
I just noticed that description explicitly says, "Yank the text between two hinted position without jumping (:HopYankChar1)." But this does make it impossible to yank the beginning from the beginning of a line, which I find myself doing more often than trying to yank text including the final character.
The behavior is the same for HopPasteChar1
where is pastes after the selection. Which... again, I get? Because of vim's paste before/paste after verbs. But, it still feels not right.
If this is intended behavior, I think a strong case can be made for inclusive first character on yank. I'm waffling on paste behavior.
My intended behavior for yank was a (exclusive,inclusive) range, but after hearing your side I think your take is more reasonable. Changing it to a (inclusive,inclusive) range is less confusing.
For paste we could make it configurable using hint_offset
so it can cover both side.
Do you want to create a pr for this?