让 Mac 外接键盘支持 HOME 键_macos home键-CSDN博客
步骤:
1、打开终端创建文件夹,并编辑 DefaultKeyBinding.dict 文件
mkdir -p ~/Library/KeyBindings
vim ~/Library/KeyBindings/DefaultKeyBinding.dict
2、往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:";
}
3、保存
4、重启