简体   繁体   English

在 Mac OS X 上使用 IntelliJ IDEA 中的键盘进行多行块选择

[英]Multi-line block select using the keyboard in IntelliJ IDEA on a Mac OS X

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.我习惯在 Eclipse 中做的一件非 vi 的事情是使用Shift + / Shift + 来阻止几行文本。 The behaviour of this text selection in Eclipse is the same as almost every other text input widget I've ever used. Eclipse 中此文本选择的行为与我曾经使用过的几乎所有其他文本输入小部件相同。 Typically I do one of two things after making the selection - delete this block or comment it out ( + / ).通常我会在进行选择后做两件事之一 - 删除此块或将其注释掉( + / )。

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 do extend the selection.如果我使用鼠标开始进行选择,则箭头键扩展选择范围。 However, I'm unable to start a selection using the keyboard alone.但是,我无法单独使用键盘开始选择。

I'm aware of the + W ever-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 键绑定的情况下)上使用键盘启动然后跨多行扩展选择区域?

Multi-line caret多行插入符

For Mac, you can use + (Hold)+ ↑ / ↓ .对于 Mac,您可以使用 + (按住)+ ↑ / ↓ For Windows, replace the with CTRL .对于 Windows,将替换为CTRL

ESC will 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.要添加自定义键盘keymap ,请按 + SHIFT + A ,键入keymap并单击Settings作为子文本的那个。 Search for Clone Caret Above and Clone Caret Below .搜索Clone Caret Above Clone Caret Below Clone Caret AboveClone Caret Below

I mapped mine to ALT + SHIFT + ↑ / ↓ .我将我的映射到ALT + SHIFT + ↑ / ↓

Bonus奖金

Try holding combinations of , SHIFT , and arrows for improved selection power.尝试按住SHIFT和箭头的组合以提高选择能力。

Sounds like you need to map it.听起来你需要映射它。 In the default key mapping Shift + and Shift + work as expected (ie as you describe).在默认键映射Shift + Shift + 按预期工作(即如您所描述)。 I do not have the vi mapping available to check it.我没有可用的 vi 映射来检查它。 Go into Settings > [IDE Settings] > Keymap .进入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 + 映射。

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.我可能为此自定义了 VIM 键盘映射,不记得它是否是默认值。 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.它几乎总是选择我想要的。

在此处输入图片说明

您可以在 IntelliJ 中使用 alt+Up/Down/Right/Left 或 alt+mouse-select 来阻止选择

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM