https://developer.aliyun.com/article/49215
简介:
首先,用XCode打开
/Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/IDETextKeyBindingSet.plist
增加
<key>My Custom Keys</key>
<dict>
<key>Move Line Up</key>
<string>selectLine:, cut:, moveUp:, moveToBeginningOfLine:, paste:, moveUp:</string>
<key>Move Line Down</key>
<string>selectLine:, cut:, moveDown:, moveToBeginningOfLine:, paste:, moveUp:</string>
<key>Duplicate Line</key>
<string>moveToBeginningOfLine:, deleteToEndOfLine:, yank:, insertNewline:, moveToBeginningOfLine:, yank:</string>
<key>Delete Line</key>
<string>selectLine:, delete:</string>
</dict>
进入xcode,Command+, 打开快捷键设置,搜索刚刚设置的key名称,输入你想设置的快捷键即可。- 给
plist
文件权限
sudo chmod 666 /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/IDETextKeyBindingSet.plist
sudo chmod 777 /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/
open /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/Resources/IDETextKeyBindingSet.plist
- 在
Insertions and Indentations
添加键值
键 | 值 |
---|---|
Duplicate Current Line |
selectLine:, copy:, moveToEndOfLine:, moveToBeginningOfLine:, paste:, moveBackward: |
Insert Line Below |
moveToEndOfLine:, insertNewline: |
- 重启
Xcode
,设置快捷键
作者:喵喵粉
链接:https://www.jianshu.com/p/fb5d0ed911aa
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。