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

Feature: HopLine whilst maintaining current cursor position

Open mraxilus opened this issue 2 years ago • 1 comments

Currently, Hop provides line movement (HopLineStart, etc.) by having the hint destination be either the start or the beginning of the destination line.

Request

I would like to be able to have commands such as HopLineCurrentPosition, HopLineCurrentPositionAC, etc. wherein the destinations hinted are vertically aligned with the current cursor position. For example, where x is a character, p is the current cursor position, and any other character a hint destination, having an initial state as follows:

xxxxxx
xxxxpxxx
xxxxxxx

The command HopLineCurrentPosition would result in:

xxxxax
xxxxpxxx
xxxxbxx

And then pressing a would move the cursor to the associated hint destination:

xxxxpx
xxxxxxxx
xxxxxxx

Considerations

If a destination line is shorter than the current cursor position, the hint should be the end of the line like so:

xxxa
xxxxxxp
xxxxb
xxxxxxcxx

mraxilus avatar Jun 18 '22 12:06 mraxilus

Yep, that looks like a valid jump target generator and should be rather simple to implement.

hadronized avatar Jun 21 '22 13:06 hadronized