Sum*_*mer 122 xcode duplicate-data line
来自Eclipse并且一直习惯于复制行,发现Xcode没有这样的功能是很奇怪的.或者是吗?
我知道可以改变系统范围的键绑定,但这不是我想要的.
Tom*_*erg 101
删除一行: Ctrl-A转到行的开头,然后Ctrl-K删除它,另一次Ctrl-K删除空行.(我不经常使用Xcode,但我已经习惯了Emacs和其他类似Emacs的文本输入,并且它似乎也适用于Xcode.)
复制一行:我不知道有很多程序有这个命令,但通常我只使用复制+粘贴 - 在Xcode中它是类CUA: Ctrl+A去行的开头,Shift+↓来选择它,Command + C复制和Command +*V粘贴两次(一次覆盖线,一次附加到它).
(来自一直打字和编辑文本的人,经常在不同的程序中,偶尔会因为在文本输入中进行一些修正而不得不用一个愚蠢的小部件分散注意力而感到生气,他无法避免记住这些序列和习惯)
小智 89
重点不是使用Cmd-C/ Cmd-V快捷键.我有同样的问题来自IntelliJ,并且只能复制行Cmd-D并删除它们Cmd-Y是一个很大的节省时间.
从那以后,它一直困扰着我.但是,看起来其他人找到了可行的解决方案.
简而言之,创建一个~/Library/KeyBindings/PBKeyBinding.dict包含以下内容的文件并重新启动Xcode.
{
"^$K" = (
"selectLine:",
"cut:"
);
"^$D" = (
"selectLine:",
"copy:",
"moveToEndOfLine:",
"insertNewline:",
"paste:",
"deleteBackward:"
);
}
Run Code Online (Sandbox Code Playgroud)
这将创建两个快捷方式:Ctrl- Shift- K用于删除当前行,Ctrl- Shift- D用于复制当前行.请注意,这只是如果你的工作不使用Xcode中的自定义键绑定集.切换到"XCode默认",事情应该工作.在Snow Leopard上的XCode 3.2上测试过.
有关Mac OS X键绑定的更多信息:http://funkworks.blogspot.it/2013/03/republishing-of-wwwerasetotheleftcompos.html
Ope*_*ena 77
删除像eclipse CTRL + D这样的行(在Xcode 4.5.1上测试):
首先,改变这些权利:
sudo chmod 666 /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/IDETextKeyBindingSet.plist
sudo chmod 777 /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/
Run Code Online (Sandbox Code Playgroud)
/Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/IDETextKeyBindingSet.plist用Xcode自己打开并添加这个新条目:
deleteToBeginningOfLine:, moveToEndOfLine:, deleteToBeginningOfLine:, deleteBackward:, moveDown:, moveToBeginningOfLine:
Run Code Online (Sandbox Code Playgroud)

重新启动Xcode并打开Xcode> Preferences> KeyBindings.找到您的宏并定义一个快捷键:

我尝试了键绑定解决方案,但它无法让它工作.然而,编辑我的XCode键绑定就像一个魅力.这就是我的成就.
此解决方案不会改变剪贴板的内容!
打开XCode键绑定:

在"编辑用户脚本"对话框中:
重复排队:
using terms from application "Xcode"
tell first text document
set {startLine, endLine} to selected paragraph range
if startLine > 1 then
set theText to (paragraphs startLine through endLine)
set theText to (theText as string)
make new paragraph at beginning of paragraph (startLine) with data theText
set selected paragraph range to {endLine + 1, endLine + endLine - startLine + 1}
else
beep 1
end if
end tell
end using terms from
Run Code Online (Sandbox Code Playgroud)
重复下线:
using terms from application "Xcode"
tell first text document
set {startLine, endLine} to selected paragraph range
if endLine < (count paragraphs) then
set theText to (paragraphs startLine through endLine)
set theText to (theText as string)
(* delete (paragraphs startLine through endLine) *)
make new paragraph at beginning of paragraph (endLine + 1) with data theText
set selected paragraph range to {startLine, endLine}
else
beep 1
end if
end tell
end using terms from
Run Code Online (Sandbox Code Playgroud)

由于Xcode 4使用键绑定很难实现,我已经使用了Keyboard Maestro(Quickeys也应该运行良好,但它并不完全兼容Lion).例如,这是我的Keyboard Maestro快捷键(绑定到⌘-⇧-D):
好的,所以我让它工作了一段时间然后突然间它坏了.现在我在这里结合了不同的帖子,找到了适用于XCode 6.3.1的解决方案.
转到/Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/Finder.
找到名为Resources的文件夹.右键单击它,按"获取信息",解锁共享和权限设置(通过按下锁定)并将其设置为"全部读取和写入".
输入文件夹并找到文件IDETextKeyBindingSet.plist.右键单击它,按"获取信息",解锁共享和权限设置(通过按下锁定)并将其设置为"全部读取和写入".
使用XCode打开文件(默认)
查找删除,右键单击并添加新行.将其命名为Delete Line.在值字段中,键入:selectLine:, deleteBackward:.(这也有重复的线路进行:selectLine:,copy:,moveToEndOfLine:,insertNewline:,paste:,deleteBackward:)

我知道这个线程是很老,但我发现使用其他的解决方案BetterTouchTool,可以执行Ctrl+A,Ctrl+K,Ctrl+K通过这样的配置在BTT一个快捷键序列:

(使用附加附加操作按钮附加第二个和第三个快捷方式)
PS:来自Eclipse,Cmd+D删除行^^
我们在 Xcode 9.0 上,键绑定仍然不起作用。叹。
我发现这个要点非常有用,所以在这里重新发布以供将来参考:
/Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/Resources/IDETextKeyBindingSet.plist</dict>
<key>Duplication</key>
<dict>
<key>Duplicate Current Line</key>
<string>moveToBeginningOfLine:, deleteToEndOfLine:, yank:, insertNewline:, moveToBeginningOfLine:, yank:</string>
<key>Duplicate Lines</key>
<string>selectLine:, copy:, moveToEndOfLine:, insertNewline:, paste:, deleteBackward:</string>
<key>Delete Line</key>
<string>selectLine:, deleteBackward:</string>
</dict>
| 归档时间: |
|
| 查看次数: |
70600 次 |
| 最近记录: |