Different keyboard for different programs?
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.