langmapper.nvim icon indicating copy to clipboard operation
langmapper.nvim copied to clipboard

Which-key trick not working anymore and folds are broken (za, etc.)

Open julien-h2 opened this issue 1 year ago • 2 comments

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.

julien-h2 avatar Sep 11 '24 19:09 julien-h2

Still haven't found how to fix it :/

julien-h2 avatar Sep 12 '24 10:09 julien-h2

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

Wansmer avatar Sep 12 '24 14:09 Wansmer