I'm looking for a Mac program that will change the keyboard layout based on the program that is currently in use. I want it to re-map certain keys to new mappings, not change the whole keyboard layout. For example, when I'm in the finder, I have a normal Mac keyboard layout. When I'm in Vim, I want to remap the escape key to one that is more reachable. Ideally this would just happen when I'm in the program without having to choose a modified layout from the keyboards option in the menu bar. I have several programs that I'd like to be able to do this with.
For Vim case, you could use Option+[ key combination, which is essentially equal to Escape. This is the default behaviour. True, it is two-key combination, but with little practice, you won't need to move your hands off the keyboard.
For the other applications you could use Karabiner problably.
Personally, I would just remap the CAPS LOCK key to escape and be done with it.