CTRL instead of OPT for word-at-a-time (switching from Windows)

I am trying out switching to 100% MacOS. I do not mouse for wrist reasons, but use a trackpad and I try to do as much as I can with the keyboard, and this is in generally pretty frustrating moving to Mac. Some things I want to learn to get used to: CMD-X, C, V. But here is one thing I use constantly and want to change to the way windows does it, as it puts the most frequently used feature where it is easiest for my pinky to get:

I want to use CTRL instead of OPT for word-at-a-time moving the cursor, deleting, etc.

(I guess in the process, OPT could best pick up the line-at-a-time jobs)

I do run Keyboard Maestro for other related reasons. Is there maybe an existing KM recipe or something I can just download and use for this?

If you want to permanently transpose the Option and Control keys then don't mess around -- change it in System Settings -> Keyboard -> Keyboard Shortcuts -> Modifier Keys:

If you want more granularity, maybe in some apps but not others, perhaps look at Karabiner-Elements to transpose these keys contextually.

I am not sure I follow the distinction (don’t mess around vs. contextually). I do not think I want to entirely transpose – ctrl and opt do other things on the Mac, I think, and I don’t want to mess with those other things. So what I want is contextual in the sense that it is just the word-at-a-time vs. line-at-a-time I want to change.

But it sounded like you might mean “contextually” something like by-app? That is not what I want – I want the word vs. line at a time switch to hold across all contexts in the sense of in all apps.

I don’t know Karabiner, so I may have just not had the knowledge to follow. Does it still seem that is best for what I want?

I believe that you need to identify which apps you want this to work with, and then tell us if you are trying to swap CRTL-arrows with OPT-arrows or just overwrite the CTRL-arrow functions.

Of course, Nige is generally much better than me in giving advice, so you could ignore me and I won't be upset. :slight_smile:

Thanks. I apologize if I’m not up on the lingo here, but I meant to say to Nige that I want this to affect all apps. And I meant to say in my post that best would be this (which is a better way to put it than I came up with):

That’s a nice expression: I don’t want to swap ctrl and opt. But I do want to swap their functions when used with arrows (across all apps). Thanks!

I think you do, given what you wrote after that.

So if you want the Control key to be the Control key except for when using it with the arrow keys to select text, take a look at this blog post.

I have no idea if it is still valid all these years later, and I'm not about to log out and in again to find out!

TBH, it's much easier to either completely swap those keys via System Settings as described or stop trying to force your Mac to emulate Windows and simply embrace the new experience (however painful that is for the first few weeks).

Absolutely—unless physical pain is involved. If that pinky finger starts hurting then explore other options, e.g. the aforementioned Karabiner, a keyboard with a slightly different layout, a keyboard with a radically different layout, programmable keyboards for a whole lot more flexibility or the old favourite (especially among Emacs users) of using a third-party app to turn “caps lock” into the control key.

I'll give it a try to see if I can do that. I'm not sure I will succeed.

I have it working. But it has a small, very small issue that I want to remove before I upload the macro. I think I've fixed the issue. I will upload it in about a minute.

Thanks. I agree with trying to embrace in most cases. (E.g. CMD-C is even more painful in this sense, but I want to embrace it.)

The present case is different, however: I move by word, in what I do, extremely extremely often. I move by line much less. Also, the easiest modifier to hit is the lower left corner key (oh, I should have said, I am not using a mac keyboard with a globe in the corner – that would make everything equally difficult here). Easiest, as in as well: I can hit shift and ctrl together in natural typing position – for shift and opt I need to move hand entirely.

So for me I want to experiment in treating this as a special case. Thanks!

Whereas I've been using a Mac for long enough that I find ⌥⇧ easier than ⌃⇧ -- it often is (barring @kevinb's point about physical pain or issues) simply what you're used to.

I've made a note to try out the instructions in that blog post if get some time on a clean machine tomorrow -- it'll be fun to find out if they still work.

1 Like

Okay here's my attempt to address your requirement. I'm not 100% sure it will work for you, and to be 100% honest, I'm not sure why it's working at all. Have you ever written a macro that you think shouldn't work, but does work?

Arrow Swapper v1.1 Macro (v11.0.4)

Arrow Swapper v1.1.kmmacros (5.7 KB)

1 Like

I tried similar before suggesting System Settings/Karabiner.

I think it's a difference between real and simulated keystrokes, and where in the Events chain the OS steps in to interpret them.

You might get round it using AS and System Events to send the keystroke (in the same way we work round similar problems with Screen Sharing and VM keystrokes) -- but using an "Execute an AppleScript" action could be too slow for this.

That may work, but I have a few tricks up my sleeve, like distinguishing the source of a key by its timing.

My thinking is that it's the other way round -- the simulated keystroke isn't injected "high" enough in the Events hierarchy to be caught as a "move one word to the left/right" event.

Silly me...

⌃→ (for example) doesn't appear to be a valid hot key trigger. Swap those for USB Device Key triggers and the macro should work.

You then have to account for the passed-through arrow key stroke -- for example, ⌃→ does nothing so is OK but ⌃⇧→ selects from insertion point to end of displayed line so the macro above selects the rest of the line (real keystroke) and the the first word of the next line (simulated keystroke).

IMO this is doable for simple/single arrow-key actions but will quickly break for anything else. So I hope you can come up with something better!

I'm not fully understanding all your points, but I think the main point is that you are trying to get multi-modifier versions of arrow keys to remap, whereas I was only thinking about single modifiers, specifically CTRL and OPT for the arrow keys, nothing more. His original post said:

So I think he was only asking about single modifier mappings for the left and right arrow keys. If he wanted to remap anything extra, I thought he would simply add more to my macro.

The main point I'm making is that, for me at least, ⌃→ and similar do not work as hot key triggers. ⌥→ and so on are fine. But if you say that ⌃→ works for you then the problem is probably at my end...

I can confirm that is the same on my Mac. ⌃→ does not work as a Keyboard Maestro hot key.

I'm fairly sure this is because those are macOS system defined hotkeys and can't be redefined. However, it might be possible to reclaim those hotkeys by disabling their functions in System Settings -> Keyboard -> Keyboard Shortcuts -> Mission Control. Although, if memory serves, even if this appears to work, it won't work in some or all native applications. I seem to recall Safari specifically won't accept certain user-defined hotkeys with only the control modifier.

2 Likes

Yes, you are absolutely right. I disabled those two Mission Control hot keys in Settings and now I can use those keys in Keyboard Maestro.

I never use Mission Control so, I'm not missing anything.

1 Like

Oooh -- nice catch! And now confirmed working in Safari.

So, taking @Airy's macro and working on only the right-arrow:

Right Arrow Swapper.kmmacros (7.8 KB)

Image

From which it's "just" a case of putting in all the other required combos...

1 Like