Xcode“移动线”键盘快捷键

时间:2013-01-15 13:54:00

标签: xcode xcode4 keyboard-shortcuts key-bindings

在Xcode 4中,我已经成功地添加了新的自定义键盘快捷键来移动线条或复制线条:

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

<key>My Custom Keys</key>
<dict>
    <key>Move Line Up</key>
    <string>selectLine:, cut:, moveUp:, moveToBeginningOfLine:, paste:, moveUp:</string>
    <key>Move Line Down</key>
    <string>selectLine:, cut:, moveDown:, moveToBeginningOfLine:, paste:, moveUp:</string>
    <key>Duplicate Line</key>
    <string>moveToBeginningOfLine:, deleteToEndOfLine:, yank:, insertNewline:, moveToBeginningOfLine:, yank:</string>
    <key>Delete Line</key>
    <string>selectLine:, delete:</string>
</dict>

Move Line Up / Down 使用复制/粘贴,我想避免。任何人都知道如何使用 yank 移动线条,就像我在那里找到的重复线Xcode duplicate line

2 个答案:

答案 0 :(得分:119)

https://stackoverflow.com/a/9078952/852828复制,因为这不是链接副本的已接受答案。

  

Xcode 4有一组新的命令用于移动光标所在的行或选定的文本command + option + []

     

⌥⌘[⌥⌘]

答案 1 :(得分:0)

如何通过菜单或热键在Xcode中移动行:

enter image description here

如果您使用的是Windows键盘,则命令将转换为:

  • ⌥⌘[ ..... Alt + Win + [
  • ⌥⌘] ..... Alt + Win + ]