Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

FR: multiple hint positions #342

Open
SephVelut opened this issue Nov 10, 2022 · 0 comments
Open

FR: multiple hint positions #342

SephVelut opened this issue Nov 10, 2022 · 0 comments

Comments

@SephVelut
Copy link

SephVelut commented Nov 10, 2022

Could we add the option to set hint_position to a table of values (e.g. BEGIN, END, MIDDLE)? I have two mappings that hop somewhere on the current line. One for BEGIN hint_position and the other for END. I would like to rely on only one mapping, with both BEGIN and END matches highlighted.

Probably the only critical change would need to be something like

-- lua/hop/jump_target.lua

-- mark_jump_targets_line()
-- ....
for _, v in pairs(hint_position) do
        local colp = col + b
        if v == hint.HintPosition.MIDDLE then
          colp = col + math.floor((b + e) / 2)
        elseif v == hint.HintPosition.END then
          colp = col + e - 1
        end
        jump_targets[#jump_targets + 1] = {
          line = line_context.line_nr,
          column = math.max(1, colp + col_offset + col_bias),
          length = math.max(0, matched_length),
          buffer = buf_handle,
          window = win_handle,
        }
end
-- ...

Ideally, Hop could have 'multiple highlighting' as a general concept, instead of hacking each individual highlight feature to include an option for multiple combinations.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant