For vim purposes, I'd like to remap CapsLock to CTRL when used in combination with other keys and ESC when used in isolation.
None of the existing solutions give both functionality - only one or the other.
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
Step by step instructions:
On High Sierra, this functionality is built into the new Karabiner Elements.
Follow the install instructions, then:
Try out KeyRemap4Macbook, specifically the part called PCKeyboardHack. A year or so ago I was able to set it up so that holding down Caps Lock worked like Ctrl, but just tapping it brought up Exposé; so what you're asking should be possible.
Configuring KR4M, although it has a GUI, can be a little tricky because of the bewildering variety of options. I think you can probably scroll through the options and just look for ones under "PCKeyboardHack."
Note: I saw someone on IRC say they were unable to get this to work with the Mountain Lion preview; I don't have Lion yet to test out if it works there, but I don't see anything online about it not working (except for this possibly-unrelated bug).