快捷鍵
1:編輯多范圍代碼:
control+shift +Click(點(diǎn)擊) 或者 control+shift+Up,control+shift+Down,control+shift+left,control+right
2:同一變量同時(shí)修改快捷鍵:control+command+e(需要把變量自動(dòng)選中定位到)
3:復(fù)制/刪除行
/Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/IDETextKeyBindingSet.plist
在Deletions下面增加:Delete Current Line黔攒,值為:
deleteToBeginningOfLine:, moveToEndOfLine:, deleteToBeginningOfLine:, deleteBackward:, moveDown:, moveToBeginningOfLine:
在Insertions and Indentations下面增加:Duplicate Current Line,值為:
selectLine:, copy:, moveToEndOfLine:, insertNewline:, paste:, deleteBackward:
然后重啟Xcode穆趴,打開設(shè)置爆班,Key Bindings祭芦,找到“Delete Current Line”和”Duplicate Current Line”這兩項(xiàng)宝剖,設(shè)置為自己想要的快捷鍵乏冀。
我設(shè)置的值是:command+delete(刪除行)
option+s(復(fù)制行)
3:移動(dòng)行
找到Xcode中的自帶的配置文件:
/Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/
Resources/IDETextKeyBindingSet.plist
用文本編輯IDETextKeyBindingSet.plist桅锄,并添加以下代碼:
<key>GDI Direction</key>
<dict>
<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 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>
重啟Xcode劫哼,在Xcode菜單中叮趴,打開Preferences,選中Key Binding权烧,在右上方搜索GDI,設(shè)置對(duì)應(yīng)快捷鍵
我設(shè)置的是 option+command+o(上移行)眯亦, option+command+o(下移行),