langmapper.nvim
langmapper.nvim copied to clipboard
Which-key trick not working anymore and folds are broken (za, etc.)
Hello I am using LazyVim and a simple langmap to switch z with another letter w. The folding is completely broken.
I am trying to fix it with this plugin but it is not working.
My investigation led me to think that the problem comes from which-key, the hack in the description does not work anymore.
Still haven't found how to fix it :/
Hi! As far as I know, which-key has been rewritten recently. Since I don't use it personally, I haven't had time to look into it and update the documentation yet.
Try adding such a construct somewhere at the beginning of your init.lua (before calling which-key):
local orig_getcharstr = vim.fn.getcharstr
vim.fn.getcharstr = function() ---@diagnostic disable-line: duplicate-set-field
local char = orig_getcharstr()
local ok, lm = pcall(require, "langmapper.utils")
if not ok then
return char
end
return lm.translate_keycode(char, "default", "ru") -- change ru for your second layout if it not ru
end