Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude targets under the cursor. #83 #87

Merged
merged 2 commits into from
Oct 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions lua/hop/jump_target.lua
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,14 @@ local function create_line_indirect_jump_targets(jump_ctx, locations, opts)
-- then, append those to the input jump target list and create the indexed jump targets
local win_bias = math.abs(vim.api.nvim_get_current_win() - jump_ctx.win_ctx.win_handle) * 1000
for _, jump_target in pairs(line_jump_targets) do
locations.jump_targets[#locations.jump_targets + 1] = jump_target
locations.indirect_jump_targets[#locations.indirect_jump_targets + 1] = {
index = #locations.jump_targets,
score = opts.distance_method(jump_ctx.win_ctx.cursor, jump_target.cursor, opts.x_bias) + win_bias,
}
local score = opts.distance_method(jump_ctx.win_ctx.cursor, jump_target.cursor, opts.x_bias) + win_bias
if score ~= 0 then
locations.jump_targets[#locations.jump_targets + 1] = jump_target
locations.indirect_jump_targets[#locations.indirect_jump_targets + 1] = {
index = #locations.jump_targets,
score = score,
}
end
end
end

Expand Down
Loading