Rakshan Shetty

Mapping Caps Lock to Esc in Linux

June 12, 2017☕️ 1 min read

Mapping Caps Lock to Esc in Linux

Switch Caps to Esc from terminal

setxkbmap -option caps:escape

For swapping Caps with Esc

setxkbmap -option caps:swapescape

On Linux Gnome desktops you can do easily with Tweak Tool

######If you want to use Caps Lock Tweak Tool > Typing > Caps Lock key behavior > Swap ESC and Caps Lock Mapping Caps Lock to Esc in Linux OR

######If you want Caps Lock and Esc key as the same key

Tweak Tool > Typing > Caps Lock key behavior > Make Caps Lock an additional ESC

For Ubuntu unity
sudo apt-get install dconf-tools

After starting the dconf-editor, navigate to org >> gnome >> desktop >> input-sources.

Add ‘caps:swapescape’ in xkb-options []

######For visual studio code, vim plugin add in your keybindings.json File > Preferences > Keyboard Shortcuts and click on the link keybindings.json

// Place your key bindings in this file to overwrite the defaults
[
  {
    "key": "capslock",
    "command": "extension.vim_escape",
    "when": "editorTextFocus && vim.active && !inDebugRepl"
  }
]

Tags: Tutorials
Rakshan Shetty

Software engineer, Learning Web development and sharing my experience