Xcode“移动线”键盘快捷键
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14339275/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Xcode "move line" keyboard shortcut
提问by dbernard
In Xcode 4, I have been sucessfully able to add new custom keyboard shortcuts to move lines around or to duplicate a line:
在 Xcode 4 中,我已经成功地添加了新的自定义键盘快捷键来移动行或复制一行:
/Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/IDETextKeyBindingSet.plist
/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>
But the Move Line Up/Downuses copy/paste, which I would like to avoid. Anyone knows how to move lines with yank, just like the Duplicate LineI found there: Xcode duplicate line
但是Move Line Up/Down使用复制/粘贴,我想避免这种情况。任何人都知道如何使用yank移动行,就像我在那里找到的Duplicate Line:Xcode 重复行
回答by jrturton
Copied from https://stackoverflow.com/a/9078952/852828as that isn't the accepted answer to the linked duplicate.
从https://stackoverflow.com/a/9078952/852828复制,因为这不是链接重复项的公认答案。
Xcode 4 has a new set of command for moving the line where the cursor is or the selected text with
command
+option
+[
or]
??[
or??]
Xcode 4 有一组新的命令,用于移动光标所在的行或使用
command
+option
+[
或]
??[
或者??]