hop.nvim
hop.nvim copied to clipboard
Docs: hint_with_callback example
I tried for some time to get hint_with_callback to work and kept running into errors. From the docs, it was unclear to me which of these I was supposed to do-- I ended up trying them all until I got the working one. I suggest adding a simple example:
local hop, hopjt = require('hop'), require('hop.jump_target')
local cb = function (target) print(target.line) end
-- option (1) -- FAIL
hop.hint_with_callback(
hopjt.jump_targets_by_scanning_lines,
hopjt.regex_by_word_start(),
cb
)
-- option (2) -- FAIL
hop.hint_with_callback(
hopjt.jump_targets_by_scanning_lines,
hopjt.regex_by_word_start,
cb
)
-- option (3) -- FAIL
hop.hint_with_callback(
hopjt.jump_targets_by_scanning_lines(hopjt.regex_by_word_start()),
{},
cb
)
-- option (4) -- FAIL
hop.hint_with_callback(
hopjt.jump_targets_by_scanning_lines(hopjt.regex_by_word_start),
{},
cb
)
-- option (5) -- OK
hop.hint_with_callback(
hopjt.jump_targets_by_scanning_lines(hopjt.regex_by_word_start),
nil,
cb
)
What kind of errors do you get?
This was months ago, so I don't recall, but I stand by my suggestion to provide an example along the lines of option (5).