1、修改权限,终端输入命令
sudo chmod 666 /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/IDETextKeyBindingSet.plist
sudo chmod 777 /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/
2、打开plist文件,终端输入命令
open /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/IDETextKeyBindingSet.plist
3、整行删除
找到 root 下的 Deletions
在 Deletions 下添加key: Delete Current Line
value:deleteToBeginningOfLine:, moveToEndOfLine:, deleteToBeginningOfLine:, deleteBackward:
4、整行复制并在其下面插入复制后的内容
找到 root 下的 Insertions and Indentations
在 Insertions and Indentations 下添加key:Duplicate Current Line
value:selectLine:, copy:, moveLeft:, moveToEndOfLine:, insertNewline:, paste:, deleteBackward:
在 Insertions and Indentations 下添加key:Insert Line Under
value:moveToEndOfLine:, insertNewline:
5、重启Xcode,设置快捷键
重启 Xcode ,在 Preferences 里找到 Key Bindings
找到Delete Current Line
和Duplicate Current Line
设置对应的快捷键