Multiple cursors in Skink: Ctrl+D, Alt+click and more
Press Ctrl+D to select the word under the cursor, then press it again to add a cursor at the next match. Type, and every cursor types. Esc goes back to a single cursor.
This works like Sublime Text and VS Code, with Micro’s action names.
Multiple cursor keys
Section titled “Multiple cursor keys”| Key | Typed command | Does |
|---|---|---|
| Ctrl+D or Alt+N | :addcursor |
Select the word; again: add a cursor at the next match |
| Alt+X | :skipcursor |
Skip this match and select the next one |
| Alt+Shift+↑ / ↓ | :cursorabove / :cursorbelow |
Add a cursor on the line above / below |
| Ctrl+Alt+↑ / ↓ | same | An alternative binding for the same |
| Alt+click | Add a cursor, or remove the one under the mouse | |
| Esc or Alt+C | :onecursor |
Back to one cursor |
The status line shows ×N while you have N cursors.
What happens at every cursor
Section titled “What happens at every cursor”- Typing, deleting, moving, indenting and moving lines (Alt+↑ / ↓).
- Case changes, join, sort and trim (
:UpperCase,:LowerCase,:TitleCase,:JoinLines,:SortLines,:TrimTrailingWhitespace). - One undo (Ctrl+Z) undoes the change at all cursors.
Copy and paste with several cursors
Section titled “Copy and paste with several cursors”- Copy with N cursors puts one line per cursor on the clipboard.
- Pasting N lines into N cursors gives each cursor its own line.
So you can copy five values from five places and paste them into five other places in one go.
Examples
Section titled “Examples”Rename a variable within a function
Section titled “Rename a variable within a function”Put the cursor on the name and press Ctrl+D once to select it. Press it again for each use you want, and Alt+X to skip a match you do not want. Type the new name.
For a rename across files that understands your code, use the language server instead: Alt+Shift+R. See Refactoring.
Add a comma at the end of ten lines
Section titled “Add a comma at the end of ten lines”Put the cursor on the first line and press Alt+Shift+↓ nine times. Press End, then type ,.
Edit every match in the file at once
Section titled “Edit every match in the file at once”For a plain replace-all, the find bar is quicker: Ctrl+F, type, Tab, type the replacement, Enter. See Find and replace.
Bind the multiple cursor actions
Section titled “Bind the multiple cursor actions”The actions use Micro’s names, so they can be bound in bindings.json:
| Action | Does |
|---|---|
SpawnMultiCursor |
Select the word, then add a cursor at the next match |
SpawnMultiCursorUp / SpawnMultiCursorDown |
Add a cursor above / below |
SkipMultiCursor |
Skip this match and select the next |
RemoveMultiCursor |
Remove the newest cursor |
RemoveAllMultiCursors |
Back to a single cursor |
For example, to remove the newest cursor with Alt+Shift+X (Micro’s format writes Shift as a capital letter):
{ "Alt-X": "RemoveMultiCursor" }See Key bindings.