DEV Community

Andy Huynh
Andy Huynh

Posted on

Vim tip - remap CAPS LOCK to control

Before

Default control mapping

After

Modded to caps lock

If carpel tunnel is a real fear, remapping control key will assuage your troubles.

Many Vim packages rely on control to unlock their Vim toolset. Tmux uses it (in conjunction with the literal letter 'b') to move to different panes (tmux). This is the primary reason for this post.

Ergonomically control is in a shitty spot on standard keyboard layouts. Reaching for control, over time, garners pain in your hands quicker than you think. I've used Vim for the past five years with no finger pain. I include instructions to remap CAPS LOCK below:

1. Open system preferences
Go to system preferences

2. Find and click the keyboard icon
mac keyboard section

3. Click modifier keys
mac modifier keys

4. Set caps lock to control
caps lock to control

5. (Optional) Set CTRL-b to CTRL-a in .tmux.conf

# Ctrl-b sucks. lets bind ctrl-a instead
unbind C-b
set -g prefix C-a
Enter fullscreen mode Exit fullscreen mode

The literal letter 'a' is closer to CAPS LOCK than 'b'.

Top comments (1)

Collapse
 
briancodes profile image
Brian

Ctrl+R in terminal for command history is one I use a lot - switching my Caps Lock now 👍