Hey Developers!
We’re excited to announce the Multi-Cursor Script Editing beta, a new feature in Script Editor that allows you to edit multiple lines of code simultaneously. Multi-Cursor can help you write code faster by helping you avoid rewriting repetitive code, copying and pasting code, formatting long lists, and more!
To enable the beta in Studio, go to File > Beta Features > Enable Multi-Cursor Script Editing.
Features
Add/Remove Cursor at Mouse
Click anywhere in the script editor to place cursors. Using the same shortcut, click on a cursor to remove it. Alt/⌥ + Click
Remove Most Recently Added Cursor
Remove the most recently added cursor. Ctrl/⌘ + U
Add Cursor Above/Below
Place a cursor directly above or below each existing cursor.
Ctrl + Alt + ↑/↓
⌘+⌥ + ↑/↓
Add Cursor to Next/Prev Matching Selection
Select a segment of code and then use the keyboard shortcut to select the next/previous matching segment. Ctrl/⌘+ D
Note: To add a cursor to the previous selection, use the Quick Open Window with Ctrl/⌘ + P and search for >Select previous occurrence!
You can also create a shortcut of your choice via the Customize Shortcuts window: File > Advanced > Customize Shortcuts > search for Select previous occurrence.
Add Cursor to All Matching Selections
Select a segment of code and then use the keyboard shortcut to select all matching segments. Shift + Alt + L / ⇧ + ⌥ + L
Add/Modify Cursor with Mouse Drag
Add a cursor with a selection or modify an existing selection by using mouse drag.
Alt/⌥ + Drag
Copy/Paste
Copy selections from multiple cursors and paste them at new cursor locations! The behavior of this feature depends on the number of cursors copied and pasted to:
-
If the number of cursors are the same, then each copied cursor pastes to each corresponding destination cursor.
-
If the number of cursors are different, then each cursor at the destination receives the entire paste with each copied cursor as a new line.
Here is a summary and keybinds for all the changes coming with this beta! For more information, please visit our documentation page.
Feature | Windows | macOS |
---|---|---|
Add/Remove Cursor at Mouse | Alt + Click | ⌥ + Click |
Remove Most Recently Added Cursor | Ctrl + U | ⌘ + U |
Add Cursor Above/Below | Above: Ctrl + Alt + ↑ Below: Ctrl + Alt + ↓ | Above: ⌘+⌥ + ↑Below: ⌘ + ⌥ + ↓ |
Add Cursor to Next/Prev Matching Selection | Ctrl + D | ⌘ + D |
Add Cursor to Every Matching Selection | Shift + Alt + L | ⇧ + ⌥ + L |
Add/Modify Cursor with Mouse Drag | Alt + Drag | ⌥ + Drag |
Copy/Paste | Copy: Ctrl + CPaste: Ctrl + V | Copy: ⌘ + C Paste: ⌘ + V |
Known Issues
Here is a list of known issues the team is actively working on resolving, these will be addressed in updates throughout the beta:
- Performance degradation when typing with ~100 or more cursors
- Some lines are not being highlighted when cursors are on empty lines
- Smaller miscellaneous edge case and behavior bugs
Looking Forward
We are using this beta to allow the Developer community to get their hands on Multi-cursor and provide any feedback/feature requests. With that in mind, we have the following planned for the Full Release of Multi-Cursor Script Editing:
Column/Block Select
Select a column or block of code/whitespace, cursors will be placed at the end of the selected block.
Match Case/Whole Word
Specify case and whole word matches when using Add Cursor to Next/Prev Match and All Matching Selections.
Split Selections into Lines
Place cursors at the end of the selections. If a selection crosses between multiple lines, the selection is split at each line end.
On-Type Formatting
Format code typed at all cursors.
Scroll Bar Markers
A visual indicator for all cursor locations on the scroll bar.
We are so excited to share this new feature with the Developer community and hope that this functionality empowers you to code more efficiently and improve your scripting experience.
Please share your feedback down below, and let us know if you have any questions or concerns!
A huge thank you to the following for their amazing efforts in developing this feature: @HugoBLH, @BobaTops, @code4xp, @mugiwarasuuper, @windy0724, @Infomancer, @idevride and @rusi_002!
Happy scripting!