Change lines and blocks
Move, copy, comment, sort and fold lines without selecting them by hand. Those without a key are in the list of commands: ⇧⌘P on the Mac, Ctrl+Shift+P on Windows and Linux.
Move, copy and delete lines
They work on the line of the cursor, or on all the lines of the selection.
| Action | Mac | Windows and Linux |
|---|---|---|
| Move up or down | ⌥↑ ⌥↓ | Alt+↑ Alt+↓ |
| Copy below | ⇧⌘D | Ctrl+Shift+D |
| Delete | ⇧⌘K | Ctrl+Shift+K |
| New line below, from any column | ⌘↩ | Ctrl+Enter |
Indent
Tab indents the selected lines, and ⇧Tab takes a level away. How the file is written says what a level is.
Comment
⌘/ on the Mac, Ctrl+/ on Windows and Linux, turns lines into comments and back, with the signs of the language. The command is called Comment or uncomment the lines.
Sort and clean lines
These commands change the lines of the selection. With nothing selected, they change the whole file.
| Command | What it does |
|---|---|
| Sort the lines | From A to Z, with capital and small letters as equals, and 2 before 10 |
| Remove repeated lines | Keeps the first of the lines that are exactly the same, also when they are not together. Empty lines count: one stays |
| Reverse the lines | Puts the last one first |
Change the case
Upper case and Lower case change what is selected, or the word of the cursor.
Fold blocks
Press the arrow next to the number of a line to fold its block, and again to open it. With the keyboard, use ⌥⌘[ and ⌥⌘] on the Mac, Ctrl+Shift+[ and Ctrl+Shift+] on Windows and Linux.
Fold everything and Unfold everything do it in the whole file. The arrows are not there if you hide the line numbers in the settings.