Java 在 Mac OS X 上使用 IntelliJ IDEA 中的键盘进行多行块选择
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22811218/
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
Multi-line block select using the keyboard in IntelliJ IDEA on a Mac OS X
提问by Greg Kopff
I've recently switched from Eclipse to IntelliJ IDEA 13. I use the VI keybindings.
我最近从 Eclipse 切换到 IntelliJ IDEA 13。我使用 VI 键绑定。
One non-vi thing I am used to doing in Eclipse is using Shift+ ↑/ Shift+ ↓to block a few lines of text. The behaviour of this text selection in Eclipse is the same as almost every other text input widget I've ever used. Typically I do one of two things after making the selection - delete this block or comment it out (?+ /).
我习惯在 Eclipse 中做的一件非 vi 的事情是使用Shift+ ↑/ Shift+↓来阻止几行文本。Eclipse 中此文本选择的行为与我使用过的几乎所有其他文本输入小部件相同。通常,我在进行选择后会做两件事之一 - 删除此块或将其注释掉 ( ?+ /)。
I have no found equivalent keyboard-only multi-line selection function in IntelliJ IDEA 13.
我在 IntelliJ IDEA 13 中没有找到等效的仅键盘多行选择功能。
Shift+ ↑does not start a block selection - it seems to page the cursor up and down the screen.
Shift+↑不启动块选择 - 它似乎在屏幕上上下翻页光标。
If I use the mouse to start making a selection, then the arrow keys doextend the selection. However, I'm unable to starta selection using the keyboard alone.
如果我使用鼠标开始进行选择,则箭头键会扩展选择范围。但是,我无法单独使用键盘开始选择。
I'm aware of the ?+ Wever-outward-growing smart element selection- but if you then use the arrow keys, the selection is lost, not extended.
我知道?+W不断向外增长的智能元素选择- 但是如果您随后使用箭头键,则选择将丢失,而不是扩展。
How can I start and then extend a selection region across multiple lines using the keyboard only on Mac OS X (that works with the VI keybindings enabled)?
如何仅在 Mac OS X(启用 VI 键绑定的情况下)上使用键盘启动然后跨多行扩展选择区域?
回答by Javaru
Sounds like you need to map it. In the default key mapping Shift+↑and Shift+↓work as expected (i.e. as you describe). I do not have the vi mapping available to check it. Go into Settings > [IDE Settings] > Keymap. In the Keymap, go to "Editor Actions". Configure the "Down with Selection" and "Up with Selection" options. This may mean removing the Shift+↑and Shift+↓mappings from something else.
听起来你需要映射它。在默认的键映射Shift+↑和Shift+↓按预期工作(即如您所描述的那样)。我没有可用的 vi 映射来检查它。进入Settings > [IDE Settings] > Keymap。在键盘映射中,转到“编辑器操作”。配置“向下选择”和“向上选择”选项。这可能意味着从其他东西中删除Shift+↑和Shift+↓映射。
回答by Michael
I use the IdeaVIM plugin on Mac OS and I can increase or decrease my selection with the keyboard only with alt-Up/Down.
我在 Mac OS 上使用 IdeaVIM 插件,我只能通过alt- Up/使用键盘增加或减少我的选择Down。
It is possible I customized the VIM keymap to this, can't remember if it is default or not. However, the editor action you are looking for in the keymap settings is "Select Word at Caret" and "Unselect Word at Caret". Repeatedly pressing the keystroke smartly selects/unselects the text. It almost always selects what I want.
我可能为此自定义了 VIM 键盘映射,不记得它是否是默认值。但是,您在键盘映射设置中寻找的编辑器操作是“在插入符号处选择单词”和“在插入符号处取消选择单词”。重复按下按键巧妙地选择/取消选择文本。它几乎总是选择我想要的。
回答by caitcoo0odes
You can use alt+Up/Down/Right/Left or alt+mouse-select to block select on mac in IntelliJ
您可以在 IntelliJ 中使用 alt+Up/Down/Right/Left 或 alt+mouse-select 来阻止选择
回答by Gibolt
Multi-line caret
多行插入符
For Mac, you can use ?+?(Hold)+↑ / ↓. For Windows, replace the ?with CTRL.
对于 Mac,您可以使用?+ ?(Hold)+ ↑ / ↓。对于Windows,替换?用CTRL。
ESCwill end multi-line mode.
ESC将结束多行模式。
Change Multi-caret Hotkey
更改多插入符号热键
To add a custom Keymap, ?+SHIFT+A, type keymap
and click on the one with Settings
as subtext. Search for Clone Caret Above
and Clone Caret Below
.
要添加自定义键盘映射,?+ SHIFT+ A,键入keymap
并单击带有Settings
作为潜台词的那个。搜索Clone Caret Above
和Clone Caret Below
。
I mapped mine to ALT+SHIFT+↑ / ↓.
我将我的映射到ALT+ SHIFT+ ↑ / ↓。
Bonus
奖金
Try holding combinations of ?, SHIFT, and arrows for improved selection power.
尝试的保持组合?,SHIFT和箭头用于改善选择电源。