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

Restore Esc mapping for custom keymaps #52

Open
mawkler opened this issue Aug 5, 2024 · 0 comments
Open

Restore Esc mapping for custom keymaps #52

mawkler opened this issue Aug 5, 2024 · 0 comments

Comments

@mawkler
Copy link

mawkler commented Aug 5, 2024

Following up the discussion from #46 here.

Here's what I've currently got with default_keymaps = false:

local function eyeliner_move(key, forward)
  return function()
    require('eyeliner').highlight({ forward = forward })
    return repeat_move['builtin_' .. key .. '_expr']()
  end
end

vim.keymap.set(nxo, 'f', eyeliner_move('f', true), opts)
vim.keymap.set(nxo, 'F', eyeliner_move('F', false), opts)
vim.keymap.set(nxo, 't', eyeliner_move('t', true), opts)
vim.keymap.set(nxo, 'T', eyeliner_move('T', false), opts)
vim.keymap.set(nxo, ';', repeat_move.repeat_last_move_next)
vim.keymap.set(nxo, ',', repeat_move.repeat_last_move_previous)

What would be neat is if eyeliner exposed a function that creates a one-shot <Esc> mapping, or perhaps even if eyeliner.highlight created that mapping. And that key mapping gets cleared once <Esc> is pressed.

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

No branches or pull requests

1 participant