alacritty/alacritty

macOS: alt/option key as meta

ralph-bergmann opened this issue · 5 comments

System

OS: macOS
Version: alacritty 0.13.2 (bb8ea18)

Logs

Keyboard and bindings: alacritty --print-events

The ‘print-events’ option generates thousands of lines per second, so I will skip it out for now.

My problem

I want to use the alt key for keybindings in Neovim.

First try

[window]
option_as_alt = "Both"

It works, but it also disables <option>+e for or <option>+l for @ on a German keyboard.

Second try

[keyboard]
bindings = [
     { key = "J", mods = "Alt", chars = "\x1bj" },
     { key = "K", mods = "Alt", chars = "\x1bk" },
     { key = "H", mods = "Alt", chars = "\x1bh" },
     { key = "L", mods = "Alt", chars = "\x1bl" },
]

I found a solution at #93 (comment). But it looks like it's not the correct syntax for a toml config file. Something is wrong with chars:

   9   [662.535757021s] [ERROR] [alacritty_config_derive] Unable to load config "/Users/ralphbergmann/.config/alacritty/alacritty.toml": Config error:
       TOML parse error at line 61, column 43
  10                                                         |
  11                                                      61 |     { key = "J", mods = "Alt", chars = "\x1bj" },
  12                                                         |                                           ^
  13                                                      invalid escape sequence
  14                                                      expected `b`, `f`, `n`, `r`, `t`, `u`, `U`, `\`, `"`

Question

What would be the best way to get the option/alt key as meta in Neovim and still have <option>+l as @ (and all the others)?

You can't have both on the same alt key. Though if you have it to only behave in the traditional way of sending special characters, then you can still create custom bindings.

Though if you have it to only behave in the traditional way of sending special characters, then you can still create custom bindings.

Means solution #2? But how can I fix these parsing error?

Just do what the error tells you to?

Is it really that hard to write "it should look like bla bla bla"?

I tried everything the error message said, but nothing worked.

The toml spec is thoroughly documented online. If you struggle with reading documentation, I recommend using a more UI-focused terminal emulator.