Remap Caps Lock to Ctrl and Esc on Ubuntu
11 March 2022 (Updated 9 July 2024)
We want to change the behaviour of CapsLock
so that when pressed on its own, it acts as Esc
, and when pressed with another key, it acts as the Ctrl
modifier. This mapping is handy for Vim.
Install dev dependencies
Install xcape
Verify xcape
installation
You should see the path to its executable (e.g., /usr/bin/xcape
).
Set up the binding of CapsLock to Ctrl and Esc
Add the following lines to your shell start up file (e.g., .zshrc
, .bashrc
).
Troubleshoot
- Install
x11-xkb-utils
ifsetxkbmap
command is not recognized.
Tagged:
Ubuntu
Thanks for your comment . Once it's approved, it will appear here.
Leave a comment