The shortcut to move a line up in Sublime Text is ⌥ + ⌘ + ↑
on macOS and ⇧ + CTRL + ↑
on Windows.
Moving Lines Up and Down in Sublime Text
Rearranging lines of code or text is a fundamental task for any developer or writer, and Sublime Text makes this incredibly efficient with its dedicated line movement shortcuts. This command is highly valued for its ability to quickly organize content without the need for cutting and pasting.
Platform-Specific Shortcuts
The keyboard shortcuts for moving lines up or down in Sublime Text vary slightly depending on your operating system. Here’s a quick reference:
Action | macOS Shortcut | Windows/Linux Shortcut |
---|---|---|
Move Line Up | ⌥ + ⌘ + ↑ |
⇧ + CTRL + ↑ |
Move Line Down | ⌥ + ⌘ + ↓ |
⇧ + CTRL + ↓ |
⌥
(Option) /Alt
: Often used for alternative functions.⌘
(Command) /CTRL
(Control): Primary modifier keys.⇧
(Shift): Used in conjunction withCTRL
on Windows/Linux.↑
(Up Arrow) /↓
(Down Arrow): Directional keys.
How to Use Line Movement Shortcuts
Using these shortcuts is straightforward and works for both single and multiple lines:
- Single Line: Place your cursor anywhere on the line you wish to move. You don't need to select the entire line.
- Multiple Lines: Select the block of lines you want to move.
- Execute Shortcut: Press the appropriate shortcut combination for your operating system. The selected line(s) will move one position up or down with each press.
Practical Applications and Benefits
These shortcuts are incredibly versatile and can significantly speed up your workflow:
- Code Refactoring: Quickly reorder functions, variables, or import statements in your code.
- Content Organization: Easily rearrange paragraphs, list items, or sections in a document.
- Debugging: Move specific lines of code to test different execution orders.
- Efficiency: Eliminates the cumbersome process of
CTRL+X
(cut), navigating, andCTRL+V
(paste).
For further details on Sublime Text's powerful features and customization options, you can explore the official Sublime Text documentation.