6. Vim Appending Text

Lesson Content

Now you may have noticed if you tried to type something you wouldn’t be able to. That’s because you are in command mode. This can get pretty confusing especially if you just want to open a file and enter text. The command mode is used for when you enter commands like h,j,k.l etc. To insert text you’ll need to enter insert mode first.

i - insert text before the cursor
O - insert text on the previous line
o - insert text on the next line
a - append text after the cursor
A - append text at the end of the line

Notice how when you type any of these insertion modes, you’ll see that vim has entered insert mode at the bottom of the shell. To exit insert mode and go back to command mode, just hit the Esc key.

Exercise

Play around with entering and exiting insertion mode.

Quiz Question

# What key is use to insert text before the cursor? > - The append command will put the cursor after the current position, while the insert command will put the cursor before it. using the append command is like moving the cursor one character to the right, and using the insert command. > - Using the insert command is like moving the cursor one character to the left, and using the append command. > You choose which depending on where you want to start typing. 1. [ ] A 2. [ ] o 3. [ ] \< 4. [x] i