How can I replace certain strings of symbols automatically?
Go to system preferences/keyboard/input sources and add the keyboard called US International PC to the list.  Then remove the others.  This keyboard turns ` ~ ' " ^ into dead keys to add accents.  So 'e produces é, ~n produces ñ.