Move cursor word by word in Alacritty

5.4k Views Asked by At

I recently started using Alacritty instead of the default Terminal.app on macOS. When using Terminal, I can jump word by word using Option with left and right arrow keys. In Alacritty this key combination is causing ;3D and ;2D to print to the screen instead of the cursor moving.

Is there a way configure Alacritty to jump word by word using Option and arrow keys?

2

There are 2 best solutions below

1
cfstras On BEST ANSWER

With tmux and zsh, add these to the alacritty config:

key_bindings:
  ...
  - { key: Right, mods: Alt, chars: "\x1BF" }
  - { key: Left,  mods: Alt, chars: "\x1BB" }
0
blake On

Since alacritty 0.13.1, config in yaml format is no longer supported, and the current version of toml doesn't support \x1B. Instead, use \u001B.

Here is an equivalent example c.f. @cfstras's example. The config file should also be called config.toml instead of config.yml now.

[keyboard]
bindings = [
  { key = "Right", mods = "Alt", chars = "\u001BF" },
  { key = "Left",  mods = "Alt", chars = "\u001BB" },
]