Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Bradf0rd91

macrumors newbie
Original poster
Mar 27, 2012
7
0
I would like to create a keyboard shortcut that replaces a word, say "like", with the following: ", like". By that, I mean the first step of the shortcut should delete the previous character (which would be a space) and then replace with other content. How can I inject an ASCII character into a keyboard shortcut (if it's possible)?
 
Feels like I'm spamming because I've mentioned the same app in 2 consecutive posts, I promise I don't work for them or get any benefit!

That said, I use TextExpander rather than the built-in replacements in OS X. I have a couple of my "snippets" that I want a similar result, eliminating a leading space. The way I've done it is to include the leading space in my key sequence, e.g. "{space}like" is replaced by ", like". OS X's built-in replacement won't allow spaces in the phrase to be replaced, but TextExpander will.

If it's not always a leading space, i.e. you want the last character before your substitution deleted no matter what that character is, I think you could accomplish that in TextExpander also, through scripting. TE supports AppleScript, Bash, Perl, etc. scripts as part of its substitutions - but I've not had to go there for my needs.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.