Undo (or confirm) text expansion

I'm trying to set up a macro to replace sharp with ♯ and flat with♭. I initially tried this with System Preferences > Keyboard text replacement, but this requires me to enter a space before the trigger, which results in for example C_♯, whereas what I really want is C♯.

So, I've turned to Keyboard Maestro. The "string is typed" trigger works well to replace the text with the character I want, only there are times when I actually want to have the word and not the symbol.

The nice thing about the macOS native text replacement is that I can undo (cmd+z), or in some cases confirm the replacement from a bubble UI element that appears at the text insertion cursor. Is there a way to recreate either behaviour?


I suspect you’ll soon get mightily annoyed at having confirm every entry (or correct half of them). Consider using a simple but unmistakable string as the trigger for your symbol replacement—maybe “ssharp” and “fflat.” The doubled letters are very fast to type and work as a clue to yourself that you want the symbol rather than the word.

I’m assuming, by the way, that you’ve decided you don’t want to use Shift-3 for sharps.

That's not a bad idea, ssharp and fflat could work. Perhaps I'll try sharpp and flatt, that way I can more easily add the extra character if I forget.

I decided not to use shift-3 because I often need the hash character too (as well as £ which is alt-3 on my system), and I seem to forget any combination of more than one modifier.

I see it like @drdrang

But there is also another way. I do it like this. After the string I type two times space.

sharp + two times space.

If I want to write "sharp", only once space until the next word begins.

So you can also use the suggestion in the bubble before typing space.

Don't forget that typing ⇧-Space or ⌘-. (or simply pausing a few seconds) will "cancel" the sequence -- so you could type "sharp" to insert the sharp symbol and "sh(⇧-Space)arp" to type "sharp".

Personally I'm proponent of prefixes so would use ";sh" and ";fl" as triggers -- YMMV.

I like the prefix idea. I may go with ^# and ^b.

The ^ should be easy to remember since ♯ ♭are typically shown as superscript, though actually achieving that is the next problem to solve!