Skip to content
Discussion options

You must be logged in to vote

For anyone reading this: I ended up writing some custom Lua code for this.

--- @param keys string
local function blocking_feedkeys(keys)
  vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(keys, true, true, true), 'x', false)
end

--- @param pos1 Position
--- @param pos2 Position
--- @return number
local function compute_distance(pos1, pos2)
	local d = vim.api.nvim_win_get_width(0) * (math.abs(pos1[1] - pos2[1])) + math.abs(pos1[2] - pos2[2])
  return d
end

--- @param motion string
--- @param initial_position Position
local function attempt_motion(motion, initial_position)
	blocking_feedkeys("v" .. motion)

	local right_position = vim.api.nvim_win_get_cursor(0)

  blocking_feedkeys("o")…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Frankwii
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant