Hacker News new | ask | show | jobs
by saagarjha 2247 days ago
> Chrome Supports Many Unix Keyboard Shortcuts

These are actually Emacs-style editing shortcuts that come are part of Cocoa's text controls. If this doesn't work in an app on macOS, that app has broken them or is trying (evidently poorly) to reimplement their own text editing widget.

4 comments

You can further Emacsify or customize text controls to your heart with a `DefaultKeyBinding.dict` file.

This what I've been using for ~8 years. Apple removed a few functions here and there but still plenty are available. Reference URL in the file comments.

    {
        /* Additional Emacs bindings:
         *
         * "<key combination>" = "functionName:";
         *
         * Key Modifiers:
         *   ^: ctrl
         *   ~: option
         *   $: shift
         *   @: command
         *
         * Instance Methods of "NSStandardKeyBindingResponding":
         * https://developer.apple.com/documentation/appkit/nsstandardkeybindingresponding
         *
         * Install under ~/Library/KeyBindings/DefaultKeyBinding.dict
         *
         * Download directly:
         * curl --create-dirs -o ~/Library/KeyBindings/DefaultKeyBinding.dict THIS_URL
         */


        "^l"  = "centerSelectionInVisibleArea:";
        "^/"  = "undo:";
        "^ "  = "setMark:";

        "~f" = "moveWordForward:";
        "~b" = "moveWordBackward:";
        "~<" = "moveToBeginningOfDocument:";
        "~>" = "moveToEndOfDocument:";
        "~v" = "pageUp:";
        "~d" = "deleteWordForward:";
        "^w" = "deleteWordBackward:";
        "~/" = "complete:";
        "~t" = "transposeWords:";

        "^x" = {
            "h"  = "selectAll:";
            "k"  = "performClose:";
            "^x" = "swapWithMark:";
            "^m" = "selectToMark:";
        };
    }
I only recently found out that you can use C-n and C-p to move around the suggestions in the url bar. Good stuff.
That explains why they don't work on Windows. I'd have been mildly surprised by them breaking many established shortcuts like Ctrl+A for Select All, and Ctrl+E for search
I still remember when I discovered that Emacs-style editing shortcuts worked in Netscape Navigator for Windows, over 20 (sigh) years ago.

Do Windows browsers no longer support them?