Xcode

快捷键

1:编辑多范围代码:
control+shift +Click(点击) 或者 control+shift+Up,control+shift+Down,control+shift+left,control+right
2:同一变量同时修改快捷键:control+command+e(需要把变量自动选中定位到)
3:复制/删除行
/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,打开设置,Key Bindings,找到“Delete Current Line”和”Duplicate Current Line”这两项,设置为自己想要的快捷键。
我设置的值是:command+delete(删除行)
option+s(复制行)
3:移动行
找到Xcode中的自带的配置文件:
/Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/
Resources/IDETextKeyBindingSet.plist
用文本编辑IDETextKeyBindingSet.plist,并添加以下代码:

    GDI Direction
    
        GDI Duplicate Current Line
        selectLine:, copy:, moveToEndOfLine:,insertNewline:, paste:, deleteBackward:
        GDI Delete Current Line
        moveToEndOfLine:, deleteToBeginningOfLine:,deleteBackward:,moveDown:,moveToEndOfLine:
        GDI Move Current Line Up
        selectLine:, cut:, moveUp:, moveToBeginningOfLine:, insertNewLine:, paste:, moveBackward:
        GDI Move Current Line Down
        selectLine:, cut:, moveDown:, moveToBeginningOfLine:, insertNewLine:, paste:, moveBackward:
        GDI Insert Line Above
        moveUp:, moveToEndOfLine:, insertNewline:
        GDI Insert Line Below
        moveToEndOfLine:, insertNewline:
    

重启Xcode,在Xcode菜单中,打开Preferences,选中Key Binding,在右上方搜索GDI,设置对应快捷键
我设置的是 option+command+o(上移行), option+command+o(下移行),

你可能感兴趣的:(Xcode)