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

HopLine in operator pending mode not working on lines as a whole

Open IngoMeyer441 opened this issue 1 year ago • 3 comments

Thanks for maintaining this nice plugin. I was trying to configure a key binding for operator pending mode which deletes several lines at once. For this a tried to add this configuration:

vim.keymap.set('', '<Space>j', function()
  hop.hint_lines({ direction = directions.AFTER_CURSOR, current_line_only = false })
end, {remap=true})

It works great to jump to a line in normal mode, but operator mode behaves a bit odd. In this example text (cursor position marked with |)

ab|c
def
ghi

I would expect to delete all lines when jumping to the last line with d<Space>j. Instead, the text

abhi

is left in the buffer. Is it somehow possible to tell hop to work on whole lines?

IngoMeyer441 avatar Feb 21 '24 15:02 IngoMeyer441

It's not possible right now.

smoka7 avatar Feb 21 '24 17:02 smoka7

The problem is even more general than that (unless I'm missing something which is very possible). hint_words for example behaves just like vim's w and b in normal mode, but in operator pending mode the AFTER_CURSOR version deletes the character with the hint too, unlike what vim does for the equivalent (dw). But then BEFORE_CURSOR works exactly like db.

Since it's different behavior depending on whether you are just navigating or in the middle of an operation, the hint_offset option is not relevant here. It would make things work correctly for operations but break it for normal navigation.

rosshadden avatar Apr 23 '24 19:04 rosshadden