最新版 Xcode 已默認(rèn)支持
Delete Line
和Duplicate
借鑒文章:高效開發(fā)iOS系列 -- 為Xcode添加刪除行宪彩、復(fù)制行快捷鍵
修改權(quán)限
修改Xcode
里快捷鍵的配置文件(plist)
權(quán)限休讳,打開終端輸入如下兩條命令:
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
刪除整行
然后找到root
下的Deletions
,在Deletions
下添加一個key:Delete Current Line
值為:
deleteToBeginningOfLine:, moveToEndOfLine:, deleteToBeginningOfLine:, deleteBackward:
復(fù)制整行和在下方添加一行
在Insertions and Indentations
下添加兩個key:
-
Duplicate Current Line
值為:selectLine:, copy:, moveLeft:, moveToEndOfLine:, insertNewline:, paste:, deleteBackward:
-
Insert Line Under
值為:moveToEndOfLine:, insertNewline:
設(shè)置快捷鍵
重啟一下Xcode
尿孔,然后在preferences
里找到Key Bindings
俊柔,就能找到Delete Current Line
和Duplicate Current Line
兩個選項(xiàng)了,最后設(shè)置自己喜歡的快捷鍵即可