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 ?
答案 0 :(得分:140)
I found how and lets share this cool feature with you. I found three cool features:
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.
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:
Also as @Narayana said in comments, Ctrl + Shift + Alt + j selects all occurrences in one shot, for one-shot refactoring.
答案 1 :(得分:18)
答案 2 :(得分:9)
按Shift
+ Alt
+ Insert
组合,在列选择模式下进行编辑。
答案 3 :(得分:6)
Windows: CTRL + CTRL (暂停)+ ↑/↓
Mac:⌘ + ⌘(暂停)+ ↑/↓
ESC 将结束多行模式。
要添加自定义键盘映射, CTRL + SHIFT + A ,请键入keymap
,然后单击{Settings
1}}作为潜台词。搜索Clone Caret Above
和Clone Caret Below
。
我将我的地图映射到 ALT + SHIFT + ↑/↓。
尝试持有 CTRL , SHIFT 和箭头的组合,以提高选择能力。
答案 4 :(得分:6)
在Mac上,我想在Android Studio 3.1.3的多行上执行⌥(选项) + shift + 鼠标单击。
答案 5 :(得分:0)
在Windows上,您可以尝试使用名为ConyEdit的插件。它具有基于正则表达式的出色列模式。
答案 6 :(得分:0)
答案 7 :(得分:0)
在macOS上,您可以使用:
点击:Control
+ Command
+ G
-选择所有相同的值
点击:Control
+ G
-每个点击组合都会选择相同的新值
按住:Option
+ Mouse Click
-用鼠标选择多行
按住:Option
+ Shift
,然后点击:Mouse Click
-为每个点击位置重复光标
答案 8 :(得分:0)
我正在使用 android studio arctic fox 并单独按 Alt,然后选择代码在 Windows 中正常工作。