先执行命令修改权限
sudo chmod 666 /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/IDETextKeyBindingSet.plist
sudo chmod 777 /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/
修改plist
- 打开
/Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/IDETextKeyBindingSet.plist
1在Deletions下面增加:
“Delete Current Line”
String类型
值:deleteToBeginningOfLine:, moveToEndOfLine:, deleteToBeginningOfLine:, deleteBackward:, moveDown:, moveToBeginningOfLine:
在Insertions and Indentations下面增加:Duplicate Current Line,String类型 值为:
selectLine:, copy:, moveToEndOfLine:, insertNewline:, paste:, deleteToBeginningOfLine:, deleteBackward:
设置快捷键:Xcode > Preferences > KeyBindings 找到对应新增的快捷item,然后添加快捷键。保存重启xcode即可。
目前复制与删除快捷可以用,但是复制的时候,插入的位置是复制当前行后的第二行。奇怪了。