在 Xcode 中选择当前行的键盘快捷键

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25329040/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 05:23:41  来源:igfitidea点击:

Keyboard shortcut to select current line in Xcode

xcode

提问by goodcow

Is there any way to select the text of the current line in Xcode? This would be equivalent to Cmd + lin Sublime or Vin vim.

有没有办法在Xcode中选择当前行的文本?这相当于Cmd + l在 Sublime 或Vvim 中。

回答by LinusGeffarth

Actually you can just use the normal Mac-Shortcuts.

其实你可以只使用普通的Mac-Shortcuts。

Beginning of Line
cmd+ shift+ >

行首
cmd+ shift+>

Middle of Line
1. cmd+ >(this brings you to the end of the line)
2. cmd+ shift+ <(selects everything to the left)

行中间
1. cmd+ >(这将带您到行尾)
2. cmd+ shift+ <(选择左侧的所有内容)

End of Line
cmd+ shift+ <

行尾
cmd+ shift+<

Hope this helps :)

希望这可以帮助 :)



Update

更新

In Xcode 8, I have found the Select Linekeyboard binding which you can set to cmd+l(that's L, not i) for instance to make Xcode select the line you're on right now when hitting that shortcut.

在 Xcode 8 中,我找到了Select Line键盘绑定,您可以将其设置为cmd+ l(即L,不是i),例如让 Xcode 在点击该快捷方式时选择您现在所在的行。

key binding in xcode settings

xcode 设置中的键绑定

回答by jpschroeder

You can actually assign a key command to this. In Xcode under Preferences > Key Bindings > Text search for "Select Line" and assign it to you preferred key command (I also prefer command-lto match Sublime Text)

您实际上可以为此分配一个键盘命令。在 Xcode 下 Preferences > Key Bindings > Text 搜索“Select Line”并将其分配给您首选的键盘命令(我也更喜欢command-l匹配 Sublime Text)

enter image description here

在此处输入图片说明

回答by Artur Trzop

It's possible to select the line with cmd+ shift+ a+ e.

可以使用cmd+ shift+ a+选择行e

(aselects from cursor till the beginning of the line, while bselects from the cursor till the end of the line).

a从光标选择到行首,而b从光标选择到行尾)。

It's a bit long shortcut but can be useful if you end up needing only part of the line or the whole.

这是一个有点长的快捷方式,但如果您最终只需要部分行或整个行,则可能很有用。

You can also split this into 2 steps:

您也可以将其分为 2 个步骤:

ctrl+ ato jump to the beginning of the line then use ctrl+ shift+ eto select till the end of the line.

ctrl+a跳转到行首,然后使用ctrl+ shift+e选择直到行尾。