daa84 / neovim-gtk

gtk ui for neovim
GNU General Public License v3.0
718 stars 57 forks source link

Neovim-gtk sends cyrillic keys in key combinations when cyrillic layout is active #227

Open YaLTeR opened 4 years ago

YaLTeR commented 4 years ago

Describe the bug So I'm not sure if this is something that needs to be necessarily fixed, but it's a little annoying. When I'm on the cyrillic layout (typing Russian text, for example) and I press Ctrl+W to delete a word in insert mode, neovim-gtk actually sends <C-ц> (ц being the letter on the W key on the Russian layout), which is not bound by default. Terminals send <C-w> regardless of the active layout, making this "just work".

Technical information (please complete the following information):

daa84 commented 4 years ago

you can try to use keymap https://github.com/neovim/neovim/blob/master/runtime/keymap/russian-jcukenwin.vim

YaLTeR commented 4 years ago

As far as I understand, it's for entering russian characters with english layout active. There's another thing called langmap which is closer to what I need, but it seems to only apply to keys by themselves, not key combinations, so it makes me able to use regular normal mode commands with the russian layout active, but not key combinations.

Kagetsuki commented 4 years ago

The same is true for Hebrew - but this is true in both gvim and in the terminal. I'm not sure this is an issue so much as a feature request? @YaLTeR do shortcuts/commands work with the Russian Cyrillic key-map in any other version of Vim?

YaLTeR commented 4 years ago

Terminals send english characters with key combinations (Ctrl, Shift, etc) regardless of the active layout, so all these do work (unlike nvim-gtk). Non-combination keys (just keys on their own in normal mode) work the same in either and can be fixed by setting langmap.

Kagetsuki commented 4 years ago

That's a misrepresentation of how terminals work. There's a key code and a character code, the character code can be different depending on the key-map but the key code will always be the same.

And for me ctrl, shift, etc. combination commands don't work with Hebrew key-map in terminal vim, gvim, nvim-gtk, nvim-qt, etc. Perahps there's some sort of exception for Cyrillic key-maps or perhaps it's a difference in OS or something (I'm on GNU/Linux)? Or maybe it's because Hebrew is especially strange because it's RTL.

Can anyone else test this? I've had to switch key-maps for so long I'm used to it but it would be very handy if it could work like @YaLTeR is wanting it to work!

YaLTeR commented 4 years ago

FYI I'm on Linux and my terminal is Alacritty.

Kagetsuki commented 4 years ago

@YaLTeR Just curious, do single key commands work for you with the other key-map? EG hitting ESC then v with the Cyrillic map active turns on selection mode? It most certainly does not work for me with HE key-map.

YaLTeR commented 4 years ago

Single key commands don't work, but this can be fixed by setting langmap. That is a special built-in functionality for translating normal mode single key commands. In my case the correct value was listed on the :h russian page.

Kagetsuki commented 4 years ago

In 20+ years of using Vim I hadn't realized this feature existed. A quick look indicates to me that using this feature, as you report, shortcuts and command should work even with the key-map in another language. Just to double check, it work for you in a standard terminal with regular NVIM?

EDIT/NOTE: To anyone who came here because I mentioned Hebrew: Hebrew IS in fact an exception because it's an RTL language - just setting langmap won't work (in any version of Vim). It should be noted however that with no special settings nvim/nvim-gkt cleanly handle RTL inline.

YaLTeR commented 4 years ago

Yes, it works both in the terminal and in nvim-gtk. However, once again, it does not affect the key combinations, so it does not fix Ctrl+something in nvim-gtk.