hop.nvim icon indicating copy to clipboard operation
hop.nvim copied to clipboard

deleting to a hopline should also include the line

Open dlants opened this issue 3 years ago • 7 comments

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.

dlants avatar Jul 20 '21 15:07 dlants

Agree. This would also work similar to standard motions like d10j. Incidentally y seems to work as expected

simonsmith avatar Jul 26 '21 12:07 simonsmith

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

jdeut avatar Oct 20 '21 16:10 jdeut

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).

hadronized avatar Oct 20 '21 21:10 hadronized

First of all, thanks for your good plugin.

How about adding the HopLineWise command?

ok97465 avatar Dec 13 '21 22:12 ok97465

I’m not sure how this would be solved now that I think about it.

hadronized avatar Jun 21 '22 09:06 hadronized

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?

dlants avatar Jun 21 '22 17:06 dlants

e.g. vim.api.nvim_set_keymap('o', 'f', "V<cmd>HopLine<cr>", {})

xnmet avatar Aug 09 '22 00:08 xnmet