Mission 06 / 52• Insert Like a Pro
Insert at Line Ends
When writing code, you constantly need to add modifiers at the beginning of a line (like `export`, `const`, or comments) or punctuation at the end (like `;`, `,`, or `{`).
Using arrow keys or walking character-by-character is slow. Vim gives you dedicated keys for both ends.
Line-end insertion
- Ijump to the first non-blank character and enter insert mode
- Ajump to the end of the line and enter insert mode (append)
- escreturn to normal mode when done typing
1const user = fetchUser(id)2const profile = loadProfile(user)3renderView(profile)Try adding `export ` before `const user`: position your cursor anywhere on that line, press `I`, type `export `, and press `esc`.
Then add a semicolon `;` at the end: press `A`, type `;`, and press `esc`. You never have to manually aim for the last column!
Tip: Think of I as 'Insert at beginning' and A as 'Append at end'.
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
1const user = fetchUser(id)2const profile = loadProfile(user)3renderView(profile)NORMAL
00:00
NextCtrl+jOpening New Lines