svg

Integrate Alacritty Keybindings with Tmux to Quickly Split Panes

linux alacritty tmux

This is how I integrate Alacritty keybindings with tmux to quickly split panes.

.tmux.conf

First, I redefine tmux’s default split commands to something easier to remember. I also make sure new panes open in the current working directory.

# Easy-to-remember split pane commands
unbind '"'
unbind %
bind \\ split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"

alacritty.toml

Next, I configure Alacritty to send the appropriate key sequences to tmux. Since my tmux prefix is Ctrl+a, Alacritty sends Ctrl+a followed by the split key.

[terminal]
shell = { program = "/usr/bin/fish", args = ["-l", "-c", "tmux a"] }

[keyboard]
bindings = [
  # Create a new Alacritty window
  { key = "N", mods = "Control|Shift", action = "CreateNewWindow" },

  # Send Ctrl+a + \ to tmux (vertical split)
  { key = "|", mods = "Control|Shift", chars = "\u0001\u005c" },

  # Send Ctrl+a + - to tmux (horizontal split)
  { key = "_", mods = "Control|Shift", chars = "\u0001\u002d" },
]

With this setup, pressing Ctrl+Shift+\ splits the tmux pane vertically, and Ctrl+Shift+- splits it horizontally. This allows me to manage panes quickly without thinking about tmux key sequences.