hadronized / hop.nvim

Neovim motions on speed!
Other
2.48k stars 138 forks source link

[BUG] Invalid 'col': out of range #361

Closed linrongbin16 closed 1 year ago

linrongbin16 commented 1 year ago

Hi, I'm using HopChar1AC to jump forward, but there's an exception Invalid 'col': out of range:

image

It's happening on a specific file, not on every file.

nikolasetiawan commented 1 year ago

Experiencing the same issue. For me, this happens when initiating hint_char1 from an empty line. It shows the following error:

Invalid 'col': out of range
BartSte commented 1 year ago

Experiencing the same issue. For me, this happens when initiating hint_char1 from an empty line. It shows the following error:

Invalid 'col': out of range

Possible duplicate from #335. I had the same issue. Ah PR was made by someone but it is not merged, unfortunately.

prss-ad commented 1 year ago

HI, I'm having the same problem . From what i gathered, it happens when on an empty line as reported. But i can also say it only happens when hint.direction is set and current_line_only is false.

-- this works flawlessly even with multiwindows vim.keymap.set({ 'n', 'x' }, 'j', function() require('hop').hint_char1() end) -- but this does not (same for F,t,T) , --- Invalid col : out of range vim.keymap.set({ 'n', 'x' }, 'f', function() require('hop').hint_char1({ direction = require('hop.hint').HintDirection.AFTER_CURSOR, current_line_only = false }) end)

Hope this helps a bit. Thanks for this plugin . It's great.

theofabilous commented 1 year ago

There's a pull request (#358) that fixes this issue, it's been open for a while. Personally I added:

  if #vim.api.nvim_get_current_line() == 0 then
    cursor_pos[2] = cursor_pos[2] - 1
  end

after line 92 in init.lua and it fixed the problem

prss-ad commented 1 year ago

Thanks theofabilous ! That works, missed the pull request...

yingmanwumen commented 1 year ago

hello, there's another PR #363 fix this bug, and it works on my machine

rudfol commented 1 year ago

There's a pull request (#358) that fixes this issue, it's been open for a while. Personally I added:

  if #vim.api.nvim_get_current_line() == 0 then
    cursor_pos[2] = cursor_pos[2] - 1
  end

after line 92 in init.lua and it fixed the problem

Absolutely greate mate, thank you!

linrongbin16 commented 1 year ago

I moved to a new fork (see #369): https://github.com/smoka7/hop.nvim, it works great to me.