在XCode中处理文本,只移动一行 [英] Manipulating text in XCode, moving one line
问题描述
在emacs中,我具有各种操作文本的功能.现在,我正在使用xcode,我想可以将emacs设置为默认编辑器,但是我想浏览obj-c对象等,所以我宁愿只为xcode实现我最常用的文本操作命令.
In emacs I have various functions to manipulate text. Now that I'm using xcode, I suppose I could make emacs my default editor, but I want to browse obj-c objects and such, so I'd rather just implement my most used text manipulation commands for xcode.
首先,在我的列表中,我想使用一个命令将当前行的文本上移/下移一行,将光标保持在当前行上.
First on my list, I'd like a command that moves the text of the current line up/down one line, keeping the cursor on the current line.
在emacs中,这是:
In emacs this is:
(defun move-one-line-downward ()
"Move current line downward once."
(interactive)
(forward-line)
(transpose-lines 1)
(forward-line -1))
如果我可以用Python编写与XCode等效的脚本,那将是最幸福的.但是,据我所知,我需要和AppleScript交流.
I'd be happiest if I could write a script in Python that would do the equivalent in XCode, but as far as I can tell, I need to talk to AppleScript to do this.
有人可以引导我逐步了解如何使用XCode吗?
Can someone walk me through how to do this with XCode?
推荐答案
Xcode 4具有一组新的命令,用于使用command
+ option
+ [
来移动光标所在的行或所选文本]
Xcode 4 has a new set of command for moving the line where the cursor is or the selected text with command
+ option
+ [
or ]
⌥⌘[
或⌥⌘]
这篇关于在XCode中处理文本,只移动一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!