Mission 07 / 52• Insert Like a Pro
Opening New Lines
In standard text editors, creating a new line requires navigating to the end of the line and hitting Enter, or going to the start and hitting Enter then up arrow.
Vim has first-class commands to open empty lines from anywhere on the current line.
Opening lines
- oopen a new line BELOW the current line and enter insert mode
- Oopen a new line ABOVE the current line and enter insert mode
1function processOrder(order) {2 validateOrder(order);3 shipOrder(order);4}Put your cursor on `validateOrder`. Press `o` to create a blank line right underneath and start typing `logOrder(order);`.
Press `esc`, then press `O` to insert a comment right above without manually moving your cursor.
Tip: Lowercase `o` opens down (below); uppercase `O` opens up (above).
Now it's your turn!
- Navigate to each green target across the code snippet.
- Use the motions and techniques learned in this lesson to land accurately on each target.
- See how fast you can complete 10 targets.
0/10
1function processOrder(order) {2 validateOrder(order);3 shipOrder(order);4}NORMAL
00:00
NextCtrl+jMaking Small Edits