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
1
const user = fetchUser(id)
2
const profile = loadProfile(user)
3
renderView(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!

0 / 4 tasks complete0.0s / 23s par0 / 35 par

Practice this lesson's commands. Each task checks your technique and the result, not just your cursor position. Take your time.

Task 1: Add export before const with I. Return to normal mode.

Expected result
  export const value = 1;
Show hint

Press I, type export , then Escape.

1
const value = 1;
jkscroll•ggGtop/bottom•Tabnext example•Enterstart•qstop•Ctrl+kCtrl+jprev/next