在使用[AndroidStudio]过程中,特喜欢删除一行和复制一行的的快捷键。而恰巧Xcode不支持这些快捷键,我们来增加这几个快捷键,以下是步骤:
修改权限
修改 Xcode 里快捷键的配置文件 (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/
打开 plist 文件
open /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/IDETextKeyBindingSet.plist
在plist中插入对应key value
<key>GDI Duplicate Current Line</key>
<string>selectLine:, copy:, moveToEndOfLine:,insertNewline:, paste:, deleteBackward:</string>
<key>GDI Delete Current Line</key>
<string>moveToEndOfLine:, deleteToBeginningOfLine:,deleteBackward:,moveDown:,moveToEndOfLine:</string>
<key>GDI Cut Current Line</key>
<string>selectLine:, cut:, moveDown:, moveToBeginningOfLine:,</string>
<key>GDI Move Current Line Up</key>
<string>selectLine:, cut:, moveUp:, moveToBeginningOfLine:, insertNewLine:, paste:, moveBackward:</string>
<key>GDI Move Current Line Down</key>
<string>selectLine:, cut:, moveDown:, moveToBeginningOfLine:, insertNewLine:, paste:, moveBackward:</string>
<key>GDI Insert Line Above</key>
<string>moveUp:, moveToEndOfLine:, insertNewline:</string>
<key>GDI Insert Line Below</key>
<string>moveToEndOfLine:, insertNewline:</string>
这个dict是一组可以设置快捷键的操作,里面的key是名称,对应的string是对应的一组操作
GDI Duplicate Current Line 复制当前行到下面一行
GDI Delete Current Line 删除当前行
GDI Delete Cut Line 剪切当前行
GDI Move Current Line Up 把当前行往上移动一行
GDI Move Current Line Down 把当前行往下移动一行
GDI Insert Line Above 在当前行上面增加一空行
GDI Insert Line Below 在当前行下面增加一空行(不管光标是否在行尾)
3. 重启Xcode,在Xcode菜单中,打开Preferences,选中Key Binding,在右上方搜索GDI: