设置整行代码上下移动:
-
找到Xcode中的自带的配置文件:
/Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/
-
Resources/IDETextKeyBindingSet.plist
-
用文本编辑IDETextKeyBindingSet.plist,并添加以下代码:
01
<key>GDI Commands</key><dict>
02
<key>GDI Duplicate Current Line</key>
03
<string>selectLine:, copy:, moveToEndOfLine:,
04
insertNewline:,
paste
:, deleteBackward:</string>
05
<key>GDI Delete Current Line</key>
06
<string>moveToEndOfLine:, deleteToBeginningOfLine:,
07
deleteBackward:, moveDown:, moveToEndOfLine:</string>
08
<key>GDI Move Current Line Up</key>
09
<string>selectLine:,
cut
:, moveUp:,
10
moveToBeginningOfLine:, insertNewLine:,
paste
:,
11
moveBackward:</string>
12
<key>GDI Move Current Line Down</key>
13
<string>selectLine:,
cut
:, moveDown:,
14
moveToBeginningOfLine:, insertNewLine:,
paste
:,
15
moveBackward:</string>
16
<key>GDI Insert Line Above</key>
17
<string>moveUp:, moveToEndOfLine:, insertNewline:</string>
18
<key>GDI Insert Line Below</key>
19
<string>moveToEndOfLine:, insertNewline:</string></dict>
这个dict是一组可以设置快捷键的操作,里面的key是名称,对应的string是对应的一组操作
GDI Duplicate Current Line 复制当前行到下面一行
GDI Delete Current 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,
原文地址: http://www.kasnet.cn/Programming-Technology/IOS/284.html