Vim Users: Replace Your Caps_lock with Esc

Many developers use Vim as their choice of command-line text editor. For a better Vim experience, you might consider replacing Caps Lock with Escape so you can alternate between insert and command modes more easily. For this single keyboard modifier, you might try to install Karabiner-Elements. However, installing Karabiner-Elements might not be necessary if you wish to modify only this one key. Instead, I propose two alternatives to change your Caps Lock key.

Alternative 1:  Mac Keyboard Modifiers

If you have a Macbook, you can directly modify your keys following these steps

  1. Go to System Settings
  2. Search for Keyboard
  3. Search for Keyboard shortcuts
  4. On the left, look for “Modifier Keys”
  5. Change the “Caps Lock Key” to “Escape”

Alternative 2: HyperKey

  1. Download HyperKey
  2. Open up the app
  3. “Remap caps lock to:” – “esc”

Warning ‼️

If you already have Karabiner-Elements installed, I highly recommend uninstalling it before using any of these alternative methods.

Steps:

  1. Uninstall the app
  2. Check that the config file exists: ls ~/.config | grep karabiner
  3. Remove the file: rm -r ~/.config/karabiner

Why not Karabiner-Elements?

I have found a few inconveniences that led me to search for alternatives. Sometimes, a warning appears that forces me to reinstall it and update to a beta version. Other times, a blue arrow appears while I am typing in VS Code, preventing me from using the Caps Lock key as intended. Of course, all these issues can be resolved, but if you want to minimize the frequency of such problems, it might be worthwhile to try another solution.

However, if you are trying to modify more than one key or plan to do so in the future, then there is no need to explore these alternatives. Karabiner-Elements will suffice. Just know that there are always other options available.

Conversation

Join the conversation

Your email address will not be published. Required fields are marked *