---
title: "Caps Lock as Esc: ergonomics for modal editors"
description: "Remap Caps Lock to Esc (or swap them) to reduce friction in modal editors: a minimal Linux recipe plus macOS and Windows notes."
date: 2026-11-02
locale: en
tags: [tips]
summary: "I've had Esc and Caps Lock swapped on the home row for almost two years; I set it up with GNOME Tweaks on Fedora and Ubuntu (Wayland). XKB options, how to try from the terminal, and what comes up with tmux, macOS, and Windows."
url: https://escribano.dev/en/blog/022-swap-esc-caps-lock/
---
I use Helix every day; before that Neovim, and before that vim. Esc's position always bothered me, one of those details you take a while to notice. I've had Esc and Caps Lock swapped (`caps:swapescape`) for almost two years, and on Linux I configure it with GNOME Tweaks. With Esc on the home row I stopped moving my whole hand every time I left insert mode.

## Swap or remap only

Two XKB options (Linux) are usually enough:

| Option | Effect |
|--------|--------|
| `caps:escape` | Caps sends Esc; the physical Esc key stays Esc |
| `caps:swapescape` | Caps and Esc swap positions |

If you still use corner Esc outside the editor, `caps:escape` leaves it there. I went with swap: the Esc I press is on the home row; Caps ended up on top and I barely need it.

## Linux

### GNOME Tweaks (how I run it)

On Fedora and Ubuntu the swap is in GNOME Tweaks → Keyboard & Mouse → Additional Layout Options → Caps Lock behavior → Swap Esc and Caps Lock. Under the hood that's the XKB option `caps:swapescape`.

I pick US layout separately in Settings → Keyboard. Tweaks and `gsettings set org.gnome.desktop.input-sources xkb-options` write the same key; they are not two layers that add up. The clash shows up if you also force something else with `localectl` or `setxkbmap`. Note: a `gsettings set … xkb-options` overwrites the entire XKB options list (if you already had others, include them in the same array).

Package: `gnome-tweaks` (Fedora and Ubuntu; `gnome-tweak-tool` is obsolete).

### Try from the terminal (temporary)

Good for a quick test on X11 or XWayland; on native GNOME Wayland it may be ignored. I use Wayland, so this path does not work for me.

```bash
setxkbmap -option caps:swapescape
```

Remap only (Caps → Esc, physical Esc unchanged):

```bash
setxkbmap -option caps:escape
```

To switch options, clear first:

```bash
setxkbmap -option ''
setxkbmap -option caps:swapescape
```

### Other ways to persist

Without the Tweaks GUI, the same swap in GNOME:

```bash
gsettings set org.gnome.desktop.input-sources xkb-options "['caps:swapescape']"
```

X11 map and graphical login keyboard (not the VT console; that's `localectl set-keymap`):

```bash
sudo localectl set-x11-keymap us pc105 "" caps:swapescape
```

Replace `us` with your layout. I don't use `localectl` since I have it in Tweaks.

On GNOME with Wayland the user session uses dconf (`gsettings`), not that X11 map; running `localectl set-x11-keymap` may change nothing in your graphical session.

### tmux

The client does the remap; tmux does not remap Esc. If Helix (or vim) inside tmux feels Esc is "slow" (tmux waits to see if Esc starts a sequence), lower `escape-time` in `~/.tmux.conf`, for example `set -g escape-time 10`. The default is 500 ms; check yours with `tmux show -g escape-time`.

## Caps as Ctrl, Esc on tap

Another common path: Caps as Ctrl while held and Esc on a quick tap. That is not `caps:escape` or the swap: e.g. `ctrl:nocaps` or `caps:ctrl_modifier` plus a tool that sends Esc on release.

`xcape` is X11 only; on XWayland it only affects X11 apps, not native GNOME Wayland apps. I'm on Wayland; there you want `keyd`, interception-tools, or firmware remap (QMK/VIA). I don't use it; the swap is enough for me.

## macOS and Windows

**macOS:** Since macOS Sierra (10.12.1), System Settings → Keyboard → Keyboard Shortcuts → Modifier Keys → Caps Lock → Escape (before that, Karabiner or other tools). It is per keyboard: an external one is configured separately from the laptop's.

**Windows:** PowerToys (Keyboard Manager) or AutoHotkey on the host. Windows Terminal and WSL terminals receive keys already remapped by Windows; changing the layout inside the Linux distro is not enough.

## Closing

If you are unsure, try one option for a week in your modal editor and decide afterward.

What about you: do you swap Esc and Caps Lock or use another Caps Lock remap? What else do you do to improve your modal editor experience?
