What I'm looking for is doing the same but with the Command key ⌘. This is possible to an extent by first setting ⌥ to Esc+ and then mapping left ⌘ to left ⌥ and vice versa. Both are supported by iTerm2 out of the box (version 3.4).
The drawback of this is that now
- you can't use ⌘-TAB to toggle/cycle OS applications anymore (you have to use ⌥-TAB)
- with ⌥-TAB, toggling applications works but you can't hold ⌥ and cycle through open applications with TAB anymore
Emacs on macOS is somehow capable of supporting both readline shortcuts with ⌘ and normal ⌘-TAB behavior.
I've looked at Karabiner Elements but I haven't been able to configure it to do what I want.