Vim Exercises

Questions & Answers

What is the purpose of vim?

CLICK FOR ANSWER

To create, view, and edit files from the terminal.

How do you open an existing file with vim?

CLICK FOR ANSWER
vim path/to/file-name

What are the three vim modes we learned in this course?

CLICK FOR ANSWER
  1. Normal
  2. Insert
  3. Command Line (subset of Normal)

What is the purpose of Normal mode?

CLICK FOR ANSWER

To navigate a file, perform commands on the file, search a file.

What is the purpose of Insert mode?

CLICK FOR ANSWER

To modify the contents of a file directly with the keyboard.

In Normal mode how do you execute a write command?

CLICK FOR ANSWER
:w

In Normal mode how do you execute a quit command?

CLICK FOR ANSWER
:q

In Normal mode how do you navigate through a file?

CLICK FOR ANSWER

Many ways:

  1. directional pad arrow keys for moving left, down, up and right
  2. hjkl keys for moving left, down, up, and right
  3. $ to move to the end of a line
  4. 0 to move to the beginning of a line
  5. gg to move to the top of a file
  6. G to move to the end of a file
  7. :[line-number] to move to an exact line number
  8. w to navigate to the next word
  9. b to navigate to the previous word

In Insert mode how do you navigate through a file?

CLICK FOR ANSWER

Limited navigation. You must use the directional pad arrow keys for moving left, down, up and right.

How do you change from Normal mode into Insert mode?

CLICK FOR ANSWER

Many ways. This course showed the i key which switches to Insert mode at the current cursor location.

The a key switches to Insert mode right after the current cursor location.

How do you change from Insert mode to Normal mode?

CLICK FOR ANSWER

By pressing the escape esc key.