-
-
Notifications
You must be signed in to change notification settings - Fork 361
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
Easymotion crashes NeoVim #507
Comments
Oh wow, I just realized I haven't updated the repository from Lokaltog. I'll try that to see if it helps. |
Nope, that definitely did not help. |
Found a solution. Didn't really fix the NeoVim+EasyMotion crashing problem, but I did find a way to emulate EasyMotion using hop.nvim: https://synic.dev/article/2024-12-07/bringing-easymotion-back-to-neovim {
"smoka7/hop.nvim",
version = "*",
opts = { keys = "etovxpdygfblzhckisuran;,", quit_key = "q" },
config = function(_, opts)
local hop = require("hop")
hop.setup(opts)
-- Create custom command for hopping to character/word matches
vim.api.nvim_create_user_command("HopEasyMotion", function()
local char = vim.fn.getchar()
-- Convert numeric char code to string
char = type(char) == "number" and vim.fn.nr2char(char) or char
-- Create pattern based on input character type
local pattern
if char:match("%a") then
-- For letters: match words starting with that letter (case insensitive)
pattern = "\\c\\<" .. char
elseif char:match("[%(%)]") then
-- For parentheses: match them literally
pattern = char
elseif char == "." then
-- For period: match literal period
pattern = "\\."
else
-- For other non-letters: escape special characters
pattern = char:gsub("([%^%$%(%)%%%.%[%]%*%+%-%?])", "%%%1")
end
---@diagnostic disable-next-line: missing-fields
hop.hint_patterns({
current_line_only = false,
multi_windows = true,
hint_position = require("hop.hint").HintPosition.BEGIN,
}, pattern)
end, { desc = "Hop to words starting with input character" })
end,
keys = {
{ "<leader><leader>", "<cmd>HopEasyMotion<cr>", desc = "Hop to word" },
{ ";b", "<cmd>HopWordBC<cr>", desc = "Hop to word before cursor" },
{ ";w", "<cmd>HopWord<cr>", desc = "Hop to word in current buffer" },
{ ";a", "<cmd>HopWordAC<cr>", desc = "Hop to word after cursor" },
{ ";d", "<cmd>HopLineMW<cr>", desc = "Hop to line" },
{ ";f", "<cmd>HopNodes<cr>", desc = "Hop to node" },
{ ";s", "<cmd>HopPatternMW<cr>", desc = "Hop to pattern" },
{ ";j", "<cmd>HopVertical<cr>", desc = "Hop to location vertically" },
},
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is my lazy.nvim configuration for easymotion:
My NeoVim version is:
v0.10.0-dev-2786+gb3f9da952
, though this happens with 0.9 as well.I mostly just use
<space><space>
and then a character to jump anywhere in neovim, even across windows. However, sometimes when I press the target key, neovim just crashes immediately.I have not determined exactly what causes this. It seems to be random, but more often when there's more than one split window visible.
The text was updated successfully, but these errors were encountered: