How to select multiple places (sublime) in code in Android Studio?

时间:2016-10-09 15:54:13

标签: android-studio intellij-idea shortcut jetbrains-ide

How to select multiple places in code in Android Studio ?

I want to insert the same text in multiple places in my source code. Like a have more than one mouse cursor. I used to do it in VS2012 so easily though not sure how to do it in Android Studio ?

9 个答案:

答案 0 :(得分:140)

I found how and lets share this cool feature with you. I found three cool features:

  1. For multiple selection just hold alt + shift then select whenever you want to change by mouse click then type some thing you can write at multiple places at the same time.

  2. Another cool feature is column selection. This lets you to click in a great manner and greatly of help especially when you are refactoring.

In most systems it works with holding middleMouseButton and dragging over your code and in others it works by holding alt and selecting code it acts like below:

It selects like this

  1. the third cool feature is sublime selection it finds the same word in code and let you change that or append that easily. you can do that by pressing alt + j on Windows / Linux and ctrl + g in mac. Look how it works:

its great for refactoring

Also as @Narayana said in comments, Ctrl + Shift + Alt + j selects all occurrences in one shot, for one-shot refactoring.

答案 1 :(得分:18)

您可以使用 Alt + Shift 并点击多个位置以获得多个光标。

要在文件中选择类似的事件,请使用 Alt + j

有关详情:Click Here

答案 2 :(得分:9)

Shift + Alt + Insert组合,在列选择模式下进行编辑。

答案 3 :(得分:6)

Multiline Caret(不含鼠标)

Windows: CTRL + CTRL (暂停)+ ↑/↓

Mac: + (暂停)+ ↑/↓

ESC 将结束多行模式。

更改多插入符号热键

要添加自定义键盘映射, CTRL + SHIFT + A ,请键入keymap,然后单击{Settings 1}}作为潜台词。搜索Clone Caret AboveClone Caret Below

我将我的地图映射到 ALT + SHIFT + ↑/↓

加成

尝试持有 CTRL SHIFT 和箭头的组合,以提高选择能力。

答案 4 :(得分:6)

在Mac上,我想在Android Studio 3.1.3的多行上执行⌥(选项) + shift + 鼠标单击

答案 5 :(得分:0)

在Windows上,您可以尝试使用名为ConyEdit的插件。它具有基于正则表达式的出色列模式。

答案 6 :(得分:0)

对于Mac和Windows,只需打开上下文菜单,然后单击“列选择模式”即可启用或禁用该行为。

enter image description here

答案 7 :(得分:0)

在macOS上,您可以使用:

点击:Control + Command + G-选择所有相同的值

点击:Control + G-每个点击组合都会选择相同的新值

按住:Option + Mouse Click-用鼠标选择多行

按住:Option + Shift,然后点击:Mouse Click-为每个点击位置重复光标

答案 8 :(得分:0)

我正在使用 android studio arctic fox 并单独按 Alt,然后选择代码在 Windows 中正常工作。