This is a modification of an expansion I saw on Mac Power Users Discourse by an user called @Ferrers.
One can also trigger it if the cursor is put on a word. But for LaTeX and similar mark up programs where the use of these brackets are common, it can be triggered immediately after one finishes typing the word. I find it is very time saving but I use curly brackets a lot on single words: to protect them in book and journal titles mostly. A slight modification as to placing the cursor I use for multi word strings which need brackets round them. I find it very useful now that I can markdown much LaTeX while I write I am so used to it. It is less useful if one is marking down text that is already written I have found: you create spaces you have to then undo and that kind of fiddle which defeats the object sometimes.
Yes. I have a question below too regarding cursor placement.
I think I put this one there to make a SPACE after the curly bracket before the cursor, it seemed to work but, as a matter of fact, after trying it our today, it is better just to have the cursor outside the bracket. This one is very speed orientated, I am almost speed typing and I do write emails and notes even in LaTeX sometimes, or write them LaTeX ready so to speak.
QUESTION: @peternlewis Is there a way of doing a Macro in such a way that the cursor goes back to where it was when one triggered the Macro? Do you see what I mean, that would perfect a couple of Macros I have. I understood that this is difficult to do though and haven't asked elsewhere as a consequence.
I do quite often though edit over text some time after writing it. Several macros I use are good but not so efficient when I do that. Mainly because of where the cursor ends up.
Not generally. There are three non-general ways I can think of:
Use the %|% to position the text back where it was before the macro started, but assuming that you are doing the entire text change in a single action (note that the token works simply by using a left arrow N times to get back to that location, so it will not always work depending on the context).
Use some sort of AppleScript to fetch the current text location and restore it (few applications support this).
Some applications (eg Xcode) have support for a command that Marks the current location and then can return to that location with another command.