为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文件进行修改(默认是Xcode打开),命令如下:

open /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/IDETextKeyBindingSet.plist

删除一行然后找到rootDeletions,在Deletions下添加一个key:

  1. Delete Current Line 值为:deleteToBeginningOfLine:, moveToEndOfLine:, deleteToBeginningOfLine:, deleteBackward:, moveDown:, moveToBeginningOfLine:

复制一行在Insertions and Indentations下添加两个key:

  1. Duplicate Current Line 值为:selectLine:, copy:, moveToEndOfLine:, insertNewline:, paste:, deleteBackward:
  2. Insert Line Under 值为: moveToEndOfLine:, insertNewline:

设置快捷键重点来了, 重启一下Xcode,然后在preferences里找到Key Bindings,就能找到Delete Current Line和Duplicate Current Line两个选项了,最后设置自己喜欢的快捷键即可。

results matching ""

    No results matching ""