helix icon indicating copy to clipboard operation
helix copied to clipboard

Can't map commands to special accented keys

Open pem-imre opened this issue 3 years ago • 5 comments

Thanks for this great editor!

My problem is, that I use a Hungarian keyboard on which some of the default keymappings are cumbersome. For example ; is hard to press, so I want to remap it to é (which is the same position as ; in English keyboards). Unfortunately I was unable to do this mapping.

[keys.normal]
é = "collapse_selection" # Produce error "unexpected character found `\u{e9}` at line..."
"é" = "collapse_selection" # No error, but neither é or ; collapses the selection

I don't know if this is a bug, or there is a way to get this working. I found no info about accented key mapping around here or in the documentation.

pem-imre avatar Oct 13 '22 06:10 pem-imre

Could this be an issue with your terminal emulator?

On my setup (Windows 10, wezterm) I can successfully bind é using the binding with double quotes as you suggested. Note that I don't have an é key but instead used the ´ dead key + e. I'm not sure if this makes a difference.

Can you provide some more information about your setup? (i.e. OS, helix version, terminal emulator)

CptPotato avatar Oct 14 '22 07:10 CptPotato

I run Helix in tmux in WSL2 in Windows Terminal on Widows 10. I am new to Helix (captured by the speed and good defaults). The key é is working in my terminal, as I can type it without a problem. The character set of config.toml is utf-8.

I looked at the source code, and think it might be a limitaion of toml::de::from_str. Will test.

pem-imre avatar Oct 14 '22 13:10 pem-imre

Hmm this is odd. Do you have a rust development environment set up by chance? If that's the case you could try cloning crossterm and running the event-read example to see what input crossterm detects when you enter é (i.e. cargo r --example event-read).

Also just to be sure, which version of helix are you using hx -V?

CptPotato avatar Oct 14 '22 13:10 CptPotato

So im having the same issue. And its described here Im on a german keyboard and would like to map pressing ö twice to {. The toml spec doesnt allow special characters in fields without parenthesis. Is it actually possible to do this in helix?

mountainfloating avatar Nov 06 '22 21:11 mountainfloating

Okay so the solution is to put the special keys in the configuration in parenthesis like this: 'ö' = { 'ö' = "somecommand"} i think it should be described in the docs. Its discouraged to do it like this for normal characters in the toml spec.

mountainfloating avatar Nov 07 '22 06:11 mountainfloating

I think this can be closed as the author doesn't responding to help.

woojiq avatar Jan 19 '23 15:01 woojiq

I think this is solved, but we may want to add the solution to the documentation as suggested to fully solve this issue

gabydd avatar Jan 19 '23 15:01 gabydd

I added an appropriate entry to the FAQ. Also since #5656 toml error messages are improved so this should be more discoverable now

pascalkuthe avatar Jan 24 '23 18:01 pascalkuthe