hadronized / hop.nvim

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

Error when using `t` hop to first character in line #283

Closed shyun3 closed 2 years ago

shyun3 commented 2 years ago

Using this t mapping:

vim.api.nvim_set_keymap('', 't', "<cmd>lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, hint_offset = -1 })<cr>", {})

the following error occurs when hopping to a character in the first column:

E5108: Error executing lua /home/mhyun/.config/nvim/bundle/hop.nvim/lua/hop/init.lua:279: Column value outside range
stack traceback:
        [C]: in function 'nvim_win_set_cursor'
        /home/mhyun/.config/nvim/bundle/hop.nvim/lua/hop/init.lua:279: in function 'move_cursor_to'
        /home/mhyun/.config/nvim/bundle/hop.nvim/lua/hop/init.lua:288: in function 'callback'
        /home/mhyun/.config/nvim/bundle/hop.nvim/lua/hop/init.lua:392: in function 'refine_hints'
        /home/mhyun/.config/nvim/bundle/hop.nvim/lua/hop/init.lua:354: in function 'hint_with_callback'
        /home/mhyun/.config/nvim/bundle/hop.nvim/lua/hop/init.lua:287: in function 'hint_with'
        /home/mhyun/.config/nvim/bundle/hop.nvim/lua/hop/init.lua:474: in function 'hint_char1'
        [string ":lua"]:1: in main chunk

To reproduce:

hello
world

place the cursor anywhere on the first line of this snippet, then use the t mapping to jump to the "w" on the 2nd line.

hadronized commented 2 years ago

Duplicate of #261, it’s the same issue.