m4xshen/autoclose.nvim

Doesn't respect language layout

Closed this issue · 2 comments

Intro

Hello, I love the simplicity of your plugin, thanks man

Module(s)

m4xshen/autoclose.nvim, lyokha/vim-xkbswitch

Description

  • When the Russian layout is active, it is impossible to use letters that are on the same key together with '[', ']', '{', '}', `'`, `"`, '`', '~'
    image

Error that I get:

E15: Invalid expression: <Lua 174: path/to/file.lua:157>
  • I had set up vim.opt.langmap but it didn't help
local langmap_keys = {
  'ёЁ;`~', '№;#',
  'йЙ;qQ', 'цЦ;wW', 'уУ;eE', 'кК;rR', 'еЕ;tT', 'нН;yY', 'гГ;uU', 'шШ;iI', 'щЩ;oO', 'зЗ;pP', 'хХ;[{', 'ъЪ;]}',
  'фФ;aA', 'ыЫ;sS', 'вВ;dD', 'аА;fF', 'пП;gG', 'рР;hH', 'оО;jJ', 'лЛ;kK', 'дД;lL', [[жЖ;\;:]], [[эЭ;'\"]],
  'яЯ;zZ', 'чЧ;xX', 'сС;cC', 'мМ;vV', 'иИ;bB', 'тТ;nN', 'ьЬ;mM', [[бБ;\,<]], 'юЮ;.>',
}
vim.opt.langmap = table.concat(langmap_keys, ',')

Neovim version

0.9.4

Steps to reproduce

minimal reproducing config

Using folke/lazy.nvim to manage plugins.

  • autoclose
return {
      {
        "m4xshen/autoclose.nvim", enabled = true,
        config = function()
            require("autoclose").setup({
                keys = {
                    ["$"] = { escape = true, close = true, pair = "$$", disabled_filetypes = {} },
                    ["<"] = { escape = true, close = true, pair = "<>" },
                },
                options = {
                    disabled_filetypes = { "text", "markdown" },
                    disable_command_mode = true,
                }
            })
        end
    },
  }
  • xkb-switch
return {
    "lyokha/vim-xkbswitch",
}
  • opts.lua
-- ...
vim.g.XkbSwitchEnabled = 1
vim.g.XkbSwitchIMappings = { "ru" }
-- ...
  • tmux-3.3_a-7

  • setxkbmap -print -verbose 10

Setting verbose level to 10
locale is C
Trying to load rules file ./rules/evdev...
Trying to load rules file /usr/share/X11/xkb/rules/evdev...
Success.
Applied rules from evdev:
rules:      evdev
model:      pc104
layout:     us,ru
options:    ctrl:nocaps,grp:win_space_toggle
Trying to build keymap using the following components:
keycodes:   evdev+aliases(qwerty)
types:      complete
compat:     complete
symbols:    pc+us+ru:2+inet(evdev)+ctrl(nocaps)+group(win_space_toggle):1+group(win_space_toggle):2
geometry:   pc(pc104)
xkb_keymap {
	xkb_keycodes  { include "evdev+aliases(qwerty)"	};
	xkb_types     { include "complete"	};
	xkb_compat    { include "complete"	};
	xkb_symbols   { include "pc+us+ru:2+inet(evdev)+ctrl(nocaps)+group(win_space_toggle):1+group(win_space_toggle):2"	};
	xkb_geometry  { include "pc(pc104)"	};
};

Expected behavior

file.* and active Russian keyboard layout:

Before        Input         After
------------------------------------
Лорем |         х          Лорем х
Лорем |         э          Лорем э
------------------------------------

Actual behavior

file.* and active Russian keyboard layout:

Before        Input         After
------------------------------------
Лорем |         х          Лорем *ERROR*
Лорем |         э          Лорем *ERROR*
------------------------------------

I don't know anything about the keyboard switching plugin, but I wonder whether this is related to autoclose not supporting multibyte characters.

Just in case, I maintain a fork that supports multibyte characters (currently only for insert mode, though I have code for command mode as well). Just to rule that out, maybe try my fork (the main branch there) and see if it works any better?

https://github.com/telemachus/autoclose.nvim

Thanks a lot for the reply. I tried your fork, but it didn't work for me.

So, I decided to remove the xkb-switch plugin and both m4xshen/autopairs and telemachus/autopairs fork started working perfectly with tuned vim.opt.langmap except leader key which in my case is ;, but this is a vim issue and autopair plugin shouldn't try to solve this problem.