hop.nvim
hop.nvim copied to clipboard
deleting to a hopline should also include the line
When I type d
and then use a :HopLineAC
motion, every line up to but not including the line I hopped to is deleted. I think it is more intuitive to also delete the target line. I also believe that this is the way easymotion behaves.
Agree. This would also work similar to standard motions like d10j
. Incidentally y
seems to work as expected
For now one can force :HopLineAC
and every other motion to work linewise
by prepending V
just after typing the operator.
See :help forced-motion
Interesting idea. I think both methods should be possible. Right now, it’s more conservative. I’ll probably look into that, there might be something to do to allow that kind of motion for every Hop commands (some other people asked for the same feature for the current line / for any kind of jump).
First of all, thanks for your good plugin.
How about adding the HopLineWise command?
I’m not sure how this would be solved now that I think about it.
I think there's two problems - adjusting the start of the motion and the end of the motion.
The end of the motion is pretty easy - you'd need to decouple the highlight location from the motion location. So you could show the highlight at the beginning of the line for a downwards motion, but actually move to the end of the line.
The beginning of the motion seems to be the tricky part. You want to include the entire line in the motion, regardless of whether you're moving up or down, or where on the line the cursor currently is.
I'm not actually familiar with the text or motion model that vim uses, so idk if there's anything helpful in there to make this easier. It seems like there's a concept of linewise motions, and a way to force an operator to operate line-wise or character-wise. So maybe it's as simple as turning a d<hop>
into a dV<hop>
for line-wise hops?
e.g. vim.api.nvim_set_keymap('o', 'f', "V<cmd>HopLine<cr>", {})