Keep MacBook Pro awake in a clamshell mode + HDMI switcher setup
You can use caffeinate from the terminal.app.

Just open the terminal.app and type caffeinate

Without arguments it just stays awake until you ctr+C at the terminal. There are more arguments you can use in order to prevent different system components from sleeping.