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

TomOSeven

Suspended
Original poster
Jul 4, 2017
571
699
Hi all,

I'd like to change the behaviour of CTRL and ALT when navigating code / text to be like Windows. In Windows, CTRL+Backspace deletes a whole word, CTRL+Leftarrow / Rightarrow moves a whole word in that direction. Same happens in MacOS when pressing the ALT key. Since I use a Windows computer at work, I'd love to have the same behaviour on OSX. Is there a way to achieve that?

Thank you!
 
Hi all,

I'd like to change the behaviour of CTRL and ALT when navigating code / text to be like Windows. In Windows, CTRL+Backspace deletes a whole word, CTRL+Leftarrow / Rightarrow moves a whole word in that direction. Same happens in MacOS when pressing the ALT key. Since I use a Windows computer at work, I'd love to have the same behaviour on OSX. Is there a way to achieve that?

Thank you!
You can remap the Option key (what you're calling ALT) with the Control key (what you're calling CTRL) via the Keyboard settings > Modifier keys. I couldn't say what else might be affected by remapping them however.
 
  • Like
Reactions: drmeatball
Cheers mate, I have remapped some buttons already, but I want to move ONLY that specific function because I like the rest of Alt ("Option") and CTRL where they are.
 
Depending on which text/code editing application you use, this should be possible using that app's own Preferences. For example I've done a few dozen customisations in Sublime Text to get it more to my liking.

---

To customise key bindings for generic macOS text entry (e.g. TextEdit, most single-line input areas, ...) can be done by creating and populating a ~/Library/KeyBindings/DefaultKeyBinding.dict file.

It's powerful what you can do, but pretty fiddly. Here's some links on the subject:



...and my file for example:

Code:
{
    "^u" = "deleteToBeginningOfLine:";
    "^w" = "deleteWordBackward:";

    /* "Duplicate Line" */
    "@D" =
        ( "setMark:"

        , "moveToBeginningOfLine:"
        , "deleteToEndOfLine:"
        , "yank:"

        , "insertNewline:"
        , "yank:"

        , "swapWithMark:"
        , "moveDown:"
        );

    /* "Delete Line" */
    "^K" =
        ( "selectLine:"
        , "delete:"
        );

    /* "Insert Line After" */
    "@\U000D" =
        ( "moveToEndOfLine:"
        , "insertNewline:"
        );

    /* "Insert Line Before" */
    "$@\U000D" =
        ( "moveUp:"
        , "moveToEndOfLine:"
        , "insertNewline:"
        );
}
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.