Xcode重复/删除行 [英] Xcode duplicate/delete line

查看:160
本文介绍了Xcode重复/删除行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

来自Eclipse并被用来复制线,很奇怪,Xcode没有这样的功能。还是这样?



我知道可以更改系统范围的键盘,但这不是我以后的。

解决方案

整点不是使用 Cmd-C / Cmd-V 快捷方式。我有同样的问题来自IntelliJ,并且只能用 Cmd-D 重复行,并用 Cmd-Y 是一个很大的节省时间。



从那以后,我一直在欺骗我。不过,其他人似乎找到了一个解决方案。简单来说,创建一个文件〜/ Library / KeyBindings / PBKeyBinding.dict ,并重新启动Xcode 。

  {
^ $ K=(
selectLine:,
cut:
);

^ $ D=(
selectLine:,
copy:,
moveToEndOfLine:,
insertNewline: ,
paste:,
deleteBackward:
);
}

这将创建两个快捷方式: Ctrl - < kbd> Shift - K 用于删除当前行, Ctrl - Shift - D 当前行。请注意,如果您使用Xcode中的自定义键绑定设置,则可以正常工作。切换到XCode默认,事情应该工作。在雪豹XCode 3.2上测试。



有关Mac OS X键绑定的更多信息: http://funkworks.blogspot.it/2013/03/republishing-of-wwwerasetotheleftcompos.html


Coming from Eclipse and having been used to duplicate lines all the time, it's pretty strange finding out that Xcode has no such function. Or does it?

I know it's possible to change the system wide keybindings but that's not what I'm after.

解决方案

The whole point is NOT to use the Cmd-C/Cmd-V shortcuts. I have the same issue coming from IntelliJ, and being able to just duplicate lines with Cmd-D and delete them with Cmd-Y is a big time saver.

It's been bugging me ever since. However, it looks like someone else has found a solution that works.

In short, create a file ~/Library/KeyBindings/PBKeyBinding.dict with the following content and restart Xcode.

{
    "^$K" = (
        "selectLine:",
        "cut:"
    );

    "^$D" = (
        "selectLine:",
        "copy:",
        "moveToEndOfLine:",
        "insertNewline:",
        "paste:",
        "deleteBackward:"
    );
}

This will create two shortcuts: Ctrl-Shift-K for deleting the current line and Ctrl-Shift-D for duplicating the current line. Please note that this will only work if you are NOT using a custom key binding set in Xcode. Switch to "XCode Default" and things should work. Tested on XCode 3.2 on Snow Leopard.

More information on Mac OS X key bindings: http://funkworks.blogspot.it/2013/03/republishing-of-wwwerasetotheleftcompos.html

这篇关于Xcode重复/删除行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆