Reply to topic  [ 2 posts ] 
Reversing Character 
Author Message

Joined: 2010-01-06 10:58:07
Posts: 39
Has anyone ever developed a macro that reverses characters?

For example:

theer > there

whele > wheel

ohlding > holding

As I've gotten older I'm finding I'm making this kind of mistake more often.

Thansk


2011-03-03 07:57:58
Profile

Joined: 2008-05-17 04:02:32
Posts: 400
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:
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:
{
   "^'" = (
      "moveBackward:",
      "transpose:"
   );
}
"^'" defines the key combination (control-') assigned to this functionality. To execute it by another key combination, just change "^'":
Code:
^: control key
$: shift key
@: command key
~: option key
For example, "^a" for control-a, "^$n" for control-shift-n.
Attachment:
DefaultKeyBinding.dict.zip [640 Bytes]
Downloaded 221 times


2011-03-03 10:23:33
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software