Восстанавливаем работу клавиш Home и End для внешней клавиатуры на MacOS Ventura

Главная » Блог программиста » Восстанавливаем работу клавиш Home и End для внешней клавиатуры на MacOS Ventura

Просмотров: 796

Восстанавливаем работу клавиш Home и End для внешней клавиатуры на MacOS Ventura

Восстановить работу клавиш Home и End для внешней клавиатуры на MacOS Ventura довольно просто - в терминале набрать команду создания файла:

cd ~/Library && mkdir KeyBindings && cd KeyBindings && nano DefaultKeyBinding.dict

Вставить текст в файл:

{
/* Remap Home / End keys */
/* Home Button*/
"\UF729" = "moveToBeginningOfLine:";
/* End Button */
"\UF72B" = "moveToEndOfLine:";
/* Shift + Home Button */
"$\UF729" = "moveToBeginningOfLineAndModifySelection:";
/* Shift + End Button */
"$\UF72B" = "moveToEndOfLineAndModifySelection:";
/* Ctrl + Home Button */
"^\UF729" = "moveToBeginningOfDocument:";
/* Ctrl + End Button */
"^\UF72B" = "moveToEndOfDocument:";
/* Shift + Ctrl + Home Button */
"$^\UF729" = "moveToBeginningOfDocumentAndModifySelection:";
/* Shift + Ctrl + End Button*/
"$^\UF72B" = "moveToEndOfDocumentAndModifySelection:";
}

Сохранить (Ctrl+O, Ctrl+X), перезагрузить Mac после сохранения. Проверить настройки Сочетания клавиш приложений в системных настройках.
Полный список возможностей:

/* ~/Library/KeyBindings/DefaultKeyBinding.Dict

This file remaps the key bindings of a single user on Mac OS X 10.5 to more
closely match default behavior on Windows systems. This makes the Command key
behave like Windows Control key. To use Control instead of Command, either swap
Control and Command in Apple->System Preferences->Keyboard->Modifier Keys...
or replace @ with ^ in this file.

Here is a rough cheatsheet for syntax.
Key Modifiers
^ : Ctrl
$ : Shift
~ : Option (Alt)
@ : Command (Apple)
# : Numeric Keypad

Non-Printable Key Codes

Standard
Up Arrow:     \UF700        Backspace:    \U0008        F1:           \UF704
Down Arrow:   \UF701        Tab:          \U0009        F2:           \UF705
Left Arrow:   \UF702        Escape:       \U001B        F3:           \UF706
Right Arrow:  \UF703        Enter:        \U000A        ...
Insert:       \UF727        Page Up:      \UF72C
Delete:       \UF728        Page Down:    \UF72D
Home:         \UF729        Print Screen: \UF72E
End:          \UF72B        Scroll Lock:  \UF72F
Break:        \UF732        Pause:        \UF730
SysReq:       \UF731        Menu:         \UF735
Help:         \UF746

OS X
delete:       \U007F

For a good reference see http://osxnotes.net/keybindings.html.

NOTE: typically the Windows 'Insert' key is mapped to what Macs call 'Help'.
Regular Mac keyboards don't even have the Insert key, but provide 'Fn' instead,
which is completely different.
*/

{
    "@\UF72B"  = "moveToEndOfDocument:";                         /* Cmd  + End   */
    "~@\UF703" = "moveToEndOfDocument:";                         /* Cmd + Option + Right Arrow */

    "@$\UF72B" = "moveToEndOfDocumentAndModifySelection:";       /* Shift + Cmd  + End */

    "@\UF729"  = "moveToBeginningOfDocument:";                   /* Cmd  + Home  */
    "~@\UF702" = "moveToBeginningOfDocument:";                   /* Cmd + Option + Left Arrow */

    "@$\UF729" = "moveToBeginningOfDocumentAndModifySelection:"; /* Shift + Cmd  + Home */

    "\UF729"   = "moveToBeginningOfLine:";                       /* Home         */
    "~\UF702"  = "moveToBeginningOfLine:";                       /* Option + Left Arrow */

    "$\UF729"  = "moveToBeginningOfLineAndModifySelection:";     /* Shift + Home */
    "$~\UF702" = "moveToBeginningOfLineAndModifySelection:";     /* Shift + Option + Right Arrow */

    "\UF72B"   = "moveToEndOfLine:";                             /* End          */
    "~\UF703"  = "moveToEndOfLine:";                             /* Option + Right Arrow */

    "$\UF72B"  = "moveToEndOfLineAndModifySelection:";           /* Shift + End  */
    "$~\UF703" = "moveToEndOfLineAndModifySelection:";           /* Shift + Option + Left Arrow  */

    "\UF72C"   = "pageUp:";                                      /* PageUp       */
    "\UF72D"   = "pageDown:";                                    /* PageDown     */
    "$\UF728"  = "cut:";                                         /* Shift + Del  */
    "$\UF727"  = "paste:";                                       /* Shift + Ins */
    "@\UF727"  = "copy:";                                        /* Cmd  + Ins  */
    "$\UF746"  = "paste:";                                       /* Shift + Help */
    "@\UF746"  = "copy:";                                        /* Cmd  + Help (Ins) */

    "~j"       = "moveBackward:";                                /* Option + j */
    "~l"       = "moveForward:";                                 /* Option + l */
    "~i"       = "moveUp:";                                      /* Option + i */
    "~k"       = "moveDown:";                                    /* Option + k */

    "@~i"      = ("moveUp:","moveUp:","moveUp:","moveUp:","moveUp:","moveUp:","moveUp:","moveUp:",);                            /* Cmd + Option + j */
    "@~k"      = ("moveDown:","moveDown:","moveDown:","moveDown:","moveDown:","moveDown:","moveDown:","moveDown:",);                            /* Cmd + Option + j */

    "@\UF702"  = "moveWordBackward:";                            /* Cmd  + LeftArrow */
    "@~j"      = "moveWordBackward:";                            /* Cmd + Option + j */
    "@\U007F"  = "deleteWordBackward:";                          /* Cmd  + Backspace */

    "@\UF703"  = "moveWordForward:";                             /* Cmd  + RightArrow */
    "@~l"      = "moveWordForward:";                             /* Cmd + Option + l */
    "@\UF728"  = "deleteWordForward:";                           /* Cmd  + Delete */

    "@$\UF702" = "moveWordBackwardAndModifySelection:";          /* Shift + Cmd  + Leftarrow */
    "@$\UF703" = "moveWordForwardAndModifySelection:";           /* Shift + Cmd  + Rightarrow */
}

Друзья! Приглашаем вас к обсуждению. Если у вас есть своё мнение, напишите нам в комментарии.