bjast wrote:As I've gotten older I'm finding I'm making this kind of mistake more often.
Same hereĀ ;-( Or worse: it is getting harder and harder for me to detect typos.
In the past, a similar problem was discussed at:
http://www.nisus.com/forum/viewtopic.php?f=17&t=2659
To sum up, if you want to swap a character before the insertion point with a character after it, just hit
control-t which is a built-in Cocoa keybinding, working in all Cocoa applications. However, if you want to reverse two characters before the insertion point, you need something else.
Here is yet another macro attempt for the latter case, the laziest oneĀ ;-)
Code: Select all
Send Selector 'moveBackward:'
Send Selector 'transpose:'
As the macro above just call Cocoa actions via
Send Selector command, it is easy to enable the same functionality in all Cocoa applications by putting a custom keybindings dictionary (
DefaultKeyBinding.dict) in
/Users/you/Library/KeyBindings/. Attached is a sample dictionary file. It is a text file you can edit, for example, in TextEdit.
Code: Select all
{
"^'" = (
"moveBackward:",
"transpose:"
);
}
"^'" defines the key combination (
control-') assigned to this functionality. To execute it by another key combination, just change
"^'":
Code: Select all
^: control key
$: shift key
@: command key
~: option key
For example,
"^a" for
control-a,
"^$n" for
control-shift-n.